anyone out there knows how to remove pattern <random string> use sed?
Removes string "random string" :
sed 's/random string//g' inputfile
Removes lines xontaining "random string" :
sed '/random string/d' inputfile
Jean-Pierre.
I have a file with many pattern like <...>
"random string" is just an example
I want to know how to delete every thing in between < and > also "<" and ">".
<first>a<second>b<3rd>
<4th>c
becomes
ab
c
Thanks
Try :
sed 's/<\([^>]*\)>/\1 /g' inputfile
Jean-Pierre.
Hi aigles,
Thanks for the code.
Sorry, I made a mistake in my example.
The code deletes < and > but it does not delete the content within <>. I'm having trouble to figure out how to remove <, > and the stuff with in.
sed 's/<[^>]*>//g' inputfile
Jean-Pierre.
brilliant~