0

I need to delete the following string from a certain file:

Ba+/w+NWFlMa

I'm using the following command:

sed -i.bak '/Ba+/w+NWFlMa/d' /path/to/file

and getting the following error:

sed: couldn't open file +NWFlMa/d: No such file or directory

how can I fix this and make the '/' not to split the string?

Important note: this string is generated automatically and I'm invoking the command via Java code, so I don't know what will the string be the next time I'll run the code to delete it.

barsi
  • 3
  • 1
  • 5
  • 2
    You need to escape the slash: ` sed -i .bak '/Ba+\/w+NWFlMa/d' /path/to/file`. The slash is obviously special to the search command. – lurker Oct 03 '17 at 12:44

1 Answers1

0

found the solution:

sed -i.bak '\|Ba+/w+NWFlMa|d' /path/to/file
barsi
  • 3
  • 1
  • 5