Mailinglist Archive: opensuse (3349 mails)

< Previous Next >
Re: [SLE] Need help with a sed script
  • From: Greg Freemyer <greg.freemyer@xxxxxxxxx>
  • Date: Thu, 12 May 2005 18:24:11 -0400
  • Message-id: <87f94c37050512152438f0db9d@xxxxxxxxxxxxxx>
Anders,

Perfect, thanks a lot.

Your method not only fixes my syntax errors, but is even somewhat
readable. (Assuming any sed script is readable.)

Greg

On 5/12/05, Anders Johansson <andjoh@xxxxxxxxxx> wrote:
> On Friday 13 May 2005 00:09, Greg Freemyer wrote:
> > 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
>
> Well, that looks like it might be made to work. This
>
> sed -e 's/\(..\)\(....\)/\2\1/' file
>
> seems to work when I just tried it.
>
> --
> Check the headers for your unsubscription address
> For additional commands send e-mail to suse-linux-e-help@xxxxxxxx
> Also check the archives at http://lists.suse.com
> Please read the FAQs: suse-linux-e-faq@xxxxxxxx
>
>


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

< Previous Next >