0

Simply just want to change few column names in a csv file and store it as it is using this code:

sed -i -e "1s/oldcolname/" -e "1s/newcolname/" xxx.csv.

But it does not work. I got the error message :

sed: 1: "1s/oldcolname/":unterminated substitute in regular expression.

Anyone knows how to rewrite it? Thanks!

xiahfyj
  • 101
  • 1
  • 5
  • Does this answer your question? [What is wrong with my string substitution using sed on Mac OS X?](https://stackoverflow.com/questions/28592043/what-is-wrong-with-my-string-substitution-using-sed-on-mac-os-x) – takendarkk May 28 '20 at 18:24

1 Answers1

1

If you want to simply replace oldcolname with newcolname, here's a quick answer:

sed -i -e 's/oldcolname/newcolname/' your_file.csv
Algef Almocera
  • 759
  • 1
  • 6
  • 9