[wellylug] curly csv formatting
Ian Beardslee
itb at falcons.co.nz
Wed Jul 14 21:55:46 NZST 2004
Well I gotta say at the moment that looks all gobbledy gook to me :-)
-----Original Message-----
From: jumbophut <jumbophut at gmail.com>
To: wellylug at lists.naos.co.nz
Date: Tue, 13 Jul 2004 00:02:40 +1200
Subject: Re: [wellylug] curly csv formatting
> On Mon, 12 Jul 2004 23:34:33 +1200, jumbophut wrote:
> >
> > I know you've solved the problem by now, but I felt the compelling
> > need to do this in sed. Why? Well, just because sed is cool.
> >
>
> Replying to my own post, because it can be done with fewer commands
> and no jumps:
>
> /^[ \t]*[^,]\+,/ {p; s/^[
> \t]*\([^,]\+\),\([^,]\+\),\([^,]\+\),\(.*\)$/\1,\2,\3/; h; }
> /^[ \t]*,[ \t]*,/ {s/^[ \t]*,[ \t]*,[ \t]*\(,.*\)$/\1/; H; x; s/\n//;
> p; }
>
> Should have thought of that on the first go! Not quite as
> aesthetically pleasing though.
>
> (Same as last time - save to /tmp/sed2 and run using sed -n
> --file=/tmp/sed2 datafile).
>
> Tony
>
>
> --
> Wellington Linux Users Group Mailing List: wellylug at lists.naos.co.nz
> To Leave: http://lists.naos.co.nz/mailman/listinfo/wellylug
More information about the wellylug
mailing list