[Nottingham] Sed regex problem
Andy White
andy at milky.org.uk
Wed Oct 12 22:15:16 UTC 2011
Hi,
> Can anyone help me out on this one, which has got me tearing out the
> small remaining amount of hair even after googling. I want to match
> the minus sign character '-' in sed, but only if it occurs
> immediately after the 5th comma in a line that starts with '0'. So
> far I can match a minus sign following a comma in a line starting
> with '0', but matching it only after the 5th comma is beyond me.
Something like
sed -r '/^0(.*,.*)(,.*)(,.*)(,.*)(,\-).*/p'
> (More generally, I'm trying to simply invert the polarity of one of
> the fields of a .csv file. Is there an easier approach than sed?)
do what?
I tend to use perl for pretty much everything, but I'm not certain
what you're trying to do.
andy
More information about the Nottingham
mailing list