[ale] Need help with a sed script

Jim Popovitch jimpop at yahoo.com
Thu May 12 18:37:21 EDT 2005


Here is how I would do it, although there probably is 100 ways:

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

-Jim P.

On Thu, 2005-05-12 at 17:58 -0400, Greg Freemyer wrote:
> I don't use sed very often, does anyone know how to shift the first 2
> chars of every line to chars 5 & 6.
> 
> In otherwords if I have lines like:
> 
> 123456rest of line.
> 
> I need it to be:
> 
> 345612rest of line.
> 
> PS: Any tool can be used, but I have 80,000 lines to modify in a
> single file, and sed is the only tool I know for the job.
> 
> Thanks
> Greg



More information about the Ale mailing list