Gus Wirth wrote:
Michael O'Keefe wrote:
Gus Wirth wrote:
I have a bunch of lines similar to the following generated from an
rpm spec file using grep:
%{_libdir}/wine/odbc32.dll.so
I want to trim off the front part %{_libdir}/wine/ and the back part
.dll.so leaving only the base name of the file. All the lines have
exactly the same front and back parts so I can do an exact match. I'm
trying to figure out if I can do the removal in one shot or if I need
two passes to do this, but right now about the only thing I know
about sed is that it exists and is used for stuff like this. Trying
to use GNU info pages is a recipe for headaches. Is there a simple
reference for sed anywhere other than the O'Reilly sed & awk book?
Or, since this is a one-off project, can someone give me some hints?
s/^.*\/\(.*\)\.dll\.so$/\1/
GNU sed version 4.1.5
Thanks! That works great. Dissecting this expression, it seems that the
first portion ^.*\/ does a match on everything from the beginning of
the line to the last last /, then the expression in parenthesis (.*)
matches whatever is left except for the end piece which is the
\.dll\.so$ The \1 returns the chunk that is in the parenthesis.
Am I reading that correctly?
Spot on
--
Michael O'Keefe | [EMAIL PROTECTED]
Live on and Ride an 06 BMW R12GS HP2 | [EMAIL PROTECTED] / |
I like less more or less less than |Work:+1 858 845 3514 / |
more. UNIX-live it,love it,fork() it |Fax :+1 858 845 2652 /_p_|
My views are MINE ALONE, blah, blah, |Home:+1 760 788 1296 \`O'|
blah, yackety yack - don't come back |Fax :+1 858 _/_\|_,
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list