-   Linux - General (
-   -   Replacing "function(x)" with "x" using sed/awk/smth (

Griffon26 10-19-2001 03:23 PM

Replacing "function(x)" with "x" using sed/awk/smth
Subject says it all.

I can find the matches with the regular expression "function(.*)", but how do I grab the .* part of the match and send it to the output? So far I've only been able to use the entire match (not very useful if you want to remove instead of add something).

zefo 11-22-2006 11:04 AM

how about this? echo "function(x)" | sed -e "s/function(\(.*\))/\1/"

Griffon26 11-22-2006 11:31 AM

I appreciate your effort, but it's been 6 years.
In the mean time I've learned a thing or two about linux, so I could've answered my own question ;-)

zefo 11-22-2006 11:47 AM

that's allright. i am only practicing script making today.. :-)

All times are GMT -5. The time now is 01:51 AM.