-1

I'm trying to use sed to replace </link> or </title> by a space in a file, I'm using.

sed -i 's,</link>,,' file.txt

if I use the same command but without the / it works, but with it, it doesn't work. Is there a way to do it with sed?

closed as unclear what you're asking by Stephen Kitt, dr01, jimmij, Braiam, Jeff Schaller May 26 '16 at 12:47

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • What are you trying to achieve? – user1700494 May 26 '16 at 9:16
  • Your command as written here will remove the first occurrence of </link> on each line of file.txt. – roaima May 26 '16 at 9:57
  • It looks like your are trying to parse html with a regexp. Watch out for TH̘Ë͖́̉ ͠P̯͍̭O̚​N̐Y̡ – cas May 26 '16 at 12:32
1
sed -i -e  's/<\/link>/ /g' file.txt

the / is a command separator for sed, so you need to escape it with \

  • 2
    In his example he uses , as separator. This is valid. – user1700494 May 26 '16 at 10:02

Not the answer you're looking for? Browse other questions tagged or ask your own question.