Re: [Nolug] sed question

From: Fritz <fgurtler_at_gmail.com>
Date: Mon, 20 Nov 2006 16:48:26 -0600
Message-ID: <e9c2c3740611201448v422e840el8d6a173d420136a0@mail.gmail.com>

I sadly dont have a box to test this on, but try

  sed -e 's/@([0-9]*)@/\1/' or something along those lines.

On 11/20/06, David John <djohn@archdiocese-no.org> wrote:
>
> Hello List,
>
> I'm using GNU sed version 4.1.4.
> Let's say I have a file.txt that contains:
> @@1234@@ -- abcd
>
> All I want is whatever is between the "@@", e.g. 1234; the rest can be
> discarded.
>
> If I do:
> grep "@@" file.txt | tail -1 | sed -e 's/@@//' -e 's/@@//'
> it returns:
> 1234 – abcd
>
> What's the best way to get whatever is between the "@@", while discarding
> the rest of the line?
>
> (I could have "Googled" a little harder but figured I'd use the list.)
>
> Thanks.
>
> David
>
> This message has been scanned by the Internet Service Departments
> Virus/Spam filter.
>
>

___________________
Nolug mailing list
nolug@nolug.org
Received on 11/20/06

This archive was generated by hypermail 2.2.0 : 12/19/08 EST