[ale] Riddle me this awk man

Greg Freemyer greg.freemyer at gmail.com
Thu Feb 17 20:10:24 EST 2011


It works in cygwin!!!!!!

That may be a first for me.  A linux bug that does not exist in the
cygwin version.

It might be a awk vs. gawk thing.  I'll worry with it tomorrow.

Thanks for playing
Greg

On Thu, Feb 17, 2011 at 8:01 PM, Greg Freemyer <greg.freemyer at gmail.com> wrote:
> All,
>
> I'm trying to re-format the first field of a CSV file using AWK.
>
> This is what I'm trying which is very close to working:
>
> cat supertimeline.csv | awk -F" " '(NR == 1) {print};(NR > 1) { printf
> "%s-%s-%s %s", $3,$2,$4,$5; $1=""; $2="";$3="";$4=""; $5=""; print
> substr($0, 5) }' > mysupertimeline.csv
>
> But:
>
> # wc supertimeline.csv mysupertimeline.csv
>   541986   4392932  82668394 supertimeline.csv
>   174130    702866  23434337 mysupertimeline.csv
>
> I end up with only about a third as many lines.  How can that be?  The
> missing lines seem to be spread around, so it's not like it did the
> first 174,130 lines and died.
>
> I simplified it to:
>
> cat supertimeline.csv | awk -F" " ' { printf "%s-%s-%s %s",
> $3,$2,$4,$5; $1=""; $2="";$3="";$4=""; $5=""; print substr($0, 5) }' >
> mysupertimeline.csv
>
> and I get the same result.  (I have lots of free diskspace, so don't
> blame that.)
> Boo Hiss!
>
> FYI: this is ubuntu.  I'll try it on cygwin in a second just because I
> have the csv file there already.
>
>
> --
> Greg Freemyer
> Head of EDD Tape Extraction and Processing team
> Litigation Triage Solutions Specialist
> http://www.linkedin.com/in/gregfreemyer
> CNN/TruTV Aired Forensic Imaging Demo -
>    http://insession.blogs.cnn.com/2010/03/23/how-computer-evidence-gets-retrieved/
>
> The Norcross Group
> The Intersection of Evidence & Technology
> http://www.norcrossgroup.com
>



-- 
Greg Freemyer
Head of EDD Tape Extraction and Processing team
Litigation Triage Solutions Specialist
http://www.linkedin.com/in/gregfreemyer
CNN/TruTV Aired Forensic Imaging Demo -
   http://insession.blogs.cnn.com/2010/03/23/how-computer-evidence-gets-retrieved/

The Norcross Group
The Intersection of Evidence & Technology
http://www.norcrossgroup.com



More information about the Ale mailing list