[ale] Need help with a sed script

Byron A Jeff byron at cc.gatech.edu
Sat May 14 09:14:19 EDT 2005


On Thu, May 12, 2005 at 06:27:19PM -0400, Jim Popovitch wrote:
> Here is how I would do it, although there probably is 100 ways:
> 
> sed -e 's/\(..\)\(....\)\(.*\)/\2\1\3/' in-file > out-file

I'd add a couple of more mods:

sed -e 's/^\(..\)\(....\)/\2\1/' in-file > out-file

There's no need to match the rest of the line, as it'll stay in place.

Anchoring to the beginning of the line is a paranoia setting.

BAJ



More information about the Ale mailing list