sed syntax

colin davidson colinpdavidson-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Tue Feb 3 19:27:10 UTC 2009


I think you're missing backslashes in front of the opening and closing
parentheses, but it's been around 30 years since I last used sed, so I
could easily be wrong.

Colin

On 2/3/09, Matt Price <matt.price-H217xnMUJC0sA/PxXw9srA at public.gmane.org> wrote:
> ok
>
>  after all these years with linux i still have all kinds of trouble with
>  regexp's.  i have a file full of error messages from dmesg:
>
>  [125559.165041] Buffer I/O error on device sda5, logical block 19698429
>
>  (i know, it's not a good sign; i'm just trying to hang onto this drive
>  for a little longer)
>
>  i want to cut these lines back so i just have the block number:
>  19698429
>
>  now, i know i can do that with 'cut -d " " -f 10', but my first impulse
>  was to do it with sed, and i, as usual, don't understand what i'md doing
>  wrong.  since i just want the final 8-digit block number, i thought i
>  could do this:
>  cat file | sed 's/(^.*)([0-9]*$)/\2/'
>
>  but that returns the initial file unmodified.
>
>  any ints out there?  thanks as always,
>
>  matt
>
>
>  --
>  Matt Price
>  matt.price-H217xnMUJC0sA/PxXw9srA at public.gmane.org
>
> --
>  The Toronto Linux Users Group.      Meetings: http://gtalug.org/
>  TLUG requests: Linux topics, No HTML, wrap text below 80 columns
>  How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
>
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list