[Techtalk] real life kewl text-processing and regexps samples wanted

Rasjid Wilcox rasjidw at openminddev.net
Mon Jan 26 15:23:36 EST 2004


On Monday 26 January 2004 06:38, Conor Daly wrote:
> Currently I'll do:
>
> ls -l | sed -e 's/ \{1,\}/ /g' | cut -f6-8 -d' '
>
> where:
>
> sed -e 's/ \{1,\}/ /g'
>            ^^^^^^
>
> means "replace a space followed by 1 or more spaces with just one space"

Same technique, but slightly less cryptic and (perhaps) easier to remember, 
is:

$ ls -l | tr -s ' ' | cut -f6-8 -d' '

where: tr -s ' '

also means replace multiple spaces with a single space.

Cheers,

Rasjid.

-- 
Rasjid Wilcox
Canberra, Australia (UTC +11 hrs)
http://www.openminddev.net


More information about the Techtalk mailing list