[ale] AWK -- Strange chars used as separators in a CSV like file

Greg Freemyer greg.freemyer at gmail.com
Wed May 28 19:01:26 EDT 2008


Never mind.

I thought FS was supposed to be set at the shell level.

It had to be set inside the awk script.

So:

awk '
BEGIN { FS="\024" }
   { print $1,$2,$3 }
}' my_file > my_output

seems to be working.

On Wed, May 28, 2008 at 6:37 PM, Greg Freemyer <greg.freemyer at gmail.com> wrote:
> All,
>
> I have a CSV like file that uses   the octal single byte char 0376 as
> a quote char and 024 as a comma (or cntrl-T).
>
> I need to strip off the last column and discard it, so I thought I
> could use awk to do it something like.
>
> export FS='\024'
> awk '{print $1,$2,$3}' my_file > my_output
>
> It seems to still be use a space (' ') as the field seperator.  Any
> idea what I'm doing wrong?
>
> I've also tried
> FS='\\024'
> FS='\0376\024\0376'
>
> FYI: This may be a one time need and it is only about 500 lines, so
> using vi to manually do it is acceptable, but the text within the
> quotes can be very long, so it is hard to work on visually.  The good
> news is that cntrl-T (\024) should never appear within any of the
> actual fields.
>
> Thanks
> Greg
> --
> Greg Freemyer
> Litigation Triage Solutions Specialist
> http://www.linkedin.com/in/gregfreemyer
> First 99 Days Litigation White Paper -
> http://www.norcrossgroup.com/forms/whitepapers/99%20Days%20whitepaper.pdf
>
> The Norcross Group
> The Intersection of Evidence & Technology
> http://www.norcrossgroup.com
>



-- 
Greg Freemyer
Litigation Triage Solutions Specialist
http://www.linkedin.com/in/gregfreemyer
First 99 Days Litigation White Paper -
http://www.norcrossgroup.com/forms/whitepapers/99%20Days%20whitepaper.pdf

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


More information about the Ale mailing list