INPUT: $ cat a.txtFOO<td align=right style='mso-number-format:\[$-409\]m\/d\/yy\\ h\:mm\\ AM\/PM\;\@;' x:str>BAROUTPUT: $ sed 's/SOMEMAGIC//g' a.txtFOOBARMy question: How can I remove that horrible < td align...... part? This drives me nuts!!
How to remove string between two strings?
text processing
You could also use this,sed 's/^\([^<]*\)<.*>\(.*\)$/\1\2/g' fileExplanation:^\([^<]*\)< -  Fetches any charcter not of < zero or more times from the starting position upto < and finally stores the fetched characters into a group..*>     - Matches any character zero or more times until it finds >.\(.*\)$ - Once the sed finds > character, it starts to store all the characters which are next to > upto the last into another group(stores characters inbetween > and $).Finally sed prints only the stored groups(\1,\2) through back-reference.Example:$ cat file.txtFOO<td align=right style='mso-number-format:\[$-409\]m\/d\/yy\\ h\:mm\\ AM\/PM\;\@;' x:str>BAR$ sed 's/^\([^<]*\)<.*>\(.*\)$/\1\2/g' file.txtFOOBAR