I have a file with a bunch of similar lines in which I want to extract a phrase delimited by the first occurance of a '>' at the beginning and the first occurance of a '<' at the end (you might have guessed these are beginning/end of HTML tags). Using Sed I have managed to delete up to and including th first '>'. Now I want to delete from the '<' to the end of each line.
e.g.
Good Text<extraneous characters
I want to delete the '<extraneous characters' part.
I've found the above code works but it removes all lines that don't match too... Anyone know how I can have the above work but leave lines that don't match the pattern intact?
\1 is used when you have grouped parenthesis. In your code, you don't have them. so it will not work. use substitution instead. assuming always 8 digits