LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Replacing "function(x)" with "x" using sed/awk/smth (http://www.linuxquestions.org/questions/linux-general-1/replacing-function-x-with-x-using-sed-awk-smth-7731/)

Griffon26 10-19-2001 02: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 10:04 AM

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

Griffon26 11-22-2006 10: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 10:47 AM

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


All times are GMT -5. The time now is 12:23 AM.