[Nottingham] Sed regex problem
dan at caseley.me.uk
Thu Oct 13 06:33:26 UTC 2011
The fifth "column" of the CSV is a negative number that needs the sign
stripping? Or are you making positive numbers negative too?
On Oct 12, 2011 11:15 PM, "Andy White" <andy at milky.org.uk> wrote:
> > 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.
> Nottingham mailing list
> Nottingham at mailman.lug.org.uk
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Nottingham