Skip to content

Instantly share code, notes, and snippets.

@arduino-man
Created January 21, 2016 20:54
Show Gist options
  • Save arduino-man/e1833526b812f98903c5 to your computer and use it in GitHub Desktop.
Save arduino-man/e1833526b812f98903c5 to your computer and use it in GitHub Desktop.
BEGIN { RS = "\r" }
{if ($2 == 10000009287){
$5 = "Sales Nancy *"
}}
{if ($2 == 10000009296){
$5 = "Dispatch Lili *"
}}
{if ($2 == 10000054401){
$5 = "Franklin Desk *"
}}
{if($8 == "Call Duration") $8 = "Call Duration";
else{
{if($8 == "1m") $8 = "60";}
{ $8 = split($8, time, / /); if(length(time) > 1) $8 = time[1] * 60 + time[2]; else $8=time[1]+0 }}}
{ print $1,$2,$3,$4,$5,$6,$7,$8,$9 }
@neutronscott
Copy link

BEGIN { FS=OFS="," }
{ sub(/\r*$/,"") }
NF > 9 { NF=9 }
NR == 1 { print; next } # leave header alone
NF != 9 { next }
$2 == 14038009287 { $5 = "Sales Nancy *" }
$2 == 14038009296 { $5 = "Dispatch Lili *" }
$2 == 14034754401 { $5 = "Franklin Desk *" }
{
  NF=8
  split($8, time, / /)
  $8 = 0
  for (i in time) {
    if (time[i] ~ /m$/) $8 += 60 * time[i];
    else if (time[i] ~ /s$/) $8 += time[i]
  }
  print
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment