0

I'm trying to replace a line in a csv file that includes '/' characters in one of its columns. Is there a way to replace it with sed? I'm using two variables: one to store the line to replace and another one for the string that will replace it.

sed -i "/s/${CURRENTLINE}/${NEWLINE}/g"

example of the line format:

907;name;2015;4444;DOC;44;user;06/03/2015

Thanks in advance!

lerp90
  • 503
  • 8
  • 23

1 Answers1

3

Your sed command starts with s and you can use an alternate reges delimiter:

sed -i "s~${CURRENTLINE}~${NEWLINE}~g" file.csv
anubhava
  • 761,203
  • 64
  • 569
  • 643
  • You clearly know this is a duplicate, why have you answered it ? –  May 12 '15 at 12:28
  • 1
    @JID: I usually check question listed in **Related** section for any dups but on this one I didn't find anything exact dup. – anubhava May 12 '15 at 14:04