LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Using sed to change everything apart from one string (http://www.linuxquestions.org/questions/programming-9/using-sed-to-change-everything-apart-from-one-string-712497/)

deathalele 03-18-2009 08:47 AM

Using sed to change everything apart from one string
 
Say i have a line full of completely pointless stuff but useful information enclosed within some string
Quote:

nhdjasklfhduhsifhdklhdflghldhbulhl startimportantend bhfydsgbsd
can i do something like
Quote:

sed './everything apart from 'start.........end'//'
hope this is clear enough
Thanks in advance

Hko 03-18-2009 08:57 AM

Code:

echo "dhbulhl startimportantend bhfyd" | sed -n 's/^.*start\(.*\)end.*$/\1/p'

deathalele 03-22-2009 12:55 PM

Thanks.
exactly what i needed:)


All times are GMT -5. The time now is 06:59 PM.