Mailinglist Archive: opensuse (3349 mails)

< Previous Next >
Need help with a sed script
  • From: Greg Freemyer <greg.freemyer@xxxxxxxxx>
  • Date: Thu, 12 May 2005 18:09:35 -0400
  • Message-id: <87f94c37050512150948ed12a9@xxxxxxxxxxxxxx>
Anders,

I see your online, maybe you can answer this fairly quickly for me.

I don't use sed very often, how do I 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.

Reading a tutorial, I think it is something like:
sed -e 's@^\(?\)\(?\)\(?\)\(?\)\(?\)\(?\)@\3\4\5\6\1\2@' file

I'm going off to try that now.

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
--
Greg Freemyer
The Norcross Group
Forensics for the 21st Century


--
Greg Freemyer
The Norcross Group
Forensics for the 21st Century

< Previous Next >