Owen Ford wrote:
<SNIP>
seems to work a treat..
although I have NFI what
"%f\n" |sed 's/.o//g'
<SNIP>
"%f\n" means output what we found followed by a newline

sed 's/.o//g' means to replace every occurrence of .o with nothing (ie
remove it)

The sed line can be greatly improved by "anchoring" the .o to the end of
the line.  Then it would perform the substitution (s/ means substitute)
IFF the .o is at the end of the line.  The /g part means globally
replace.


The sed line can be further improved:

sed 's/\.o$//'

You need to backwhack the '.', because a period (dot) is regex-ese for "any character" - that means it could match "asdfasdfo" (the '.' would match the final 'f'). You'd need to escape it to force matching of a literal dot.

You also don't need the 'g' modifier, because that would only help if there was more than one occurence *per line* - but it doesn't hurt in this case, as find will only return one entry per line.

jack


-- [EMAIL PROTECTED] mailing list



Reply via email to