RE: text manipulation with columns

From: Leif Sawyer <lsawyer@gci.com>
Date: Mon May 03 2004 - 08:49:14 AKDT

cat data.csv | awk -F, '{ print $1 ",-" $3 "-," $2 }'
Something like that?

the -F flag for awk sets the field separator to the next
character, instead of the default whitespace

> -----Original Message-----
> From: DENNIS BYRNE [mailto:asdcb1@uaa.alaska.edu]
> Sent: Monday, May 03, 2004 8:45 AM
> To: aklug@aklug.org
> Subject: text manipulation with columns
>
>
> Let's say I have a comma-delimited data set in a text file:
>
> a,67,12/12/1212
> b,8,1/1/1111
> v,-12,3/3/2004
>
> how do I manipulate the column order so I can get:
>
> a,12/12/1212,67
> b,1/1/1111,8
> v,3/3/2004,-12
>
> Furthermore, what would be a good way to wrap each date field with
> hyphens?
>
> Dennis Byrne
>
> ---------
> To unsubscribe, send email to <aklug-request@aklug.org>
> with 'unsubscribe' in the message body.
>

-- Binary/unsupported file stripped by Ecartis --
-- Type: application/x-pkcs7-signature
-- File: smime.p7s

---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Mon May 3 08:48:02 2004

This archive was generated by hypermail 2.1.8 : Mon May 03 2004 - 08:48:04 AKDT