On Mon, 28 Jul 2003, Post, Mark K wrote:

> John,
>
> You can specify multiple things for sed to do on each record:
> sed -e 's/\(.\{0,72\}\).*/\1/' -e 's/ *$//' infile > outfile

You can do that, yes, but I prefer something that sprains the brain
less.

Some people beaver away endlessly, it seems, to create the most concise
possible expression or script to do some little chore.

Me, I prefer something easier to read (and write).

>
> For column-specific stuff, you can also use the cut command:
> cut -c1-71 infile | sed -e 's/ *$//' > outfile

This sprains the brain much less than the first: I don't care which is
more expensive to run, this I reckon is far cheaper to write (and
maintain),

I'd go a little further, though, and spread it over several lines.


--


Cheers
John.

Join the "Linux Support by Small Businesses" list at
http://mail.computerdatasafe.com.au/mailman/listinfo/lssb
Copyright John Summerfield. Reproduction prohibited.

Reply via email to