Delete "," in the first and last line of a CSV

Asked

Viewed 82 times

-1

I have a csv that’s exported like this:

+++ Host - Begin +++,,
Name,Description
test1,abc2
test2, abd3
+++ Host - End +++,,

How do I get this result?

+++ Host - Begin +++
Name,Description
test1,abc2
test2, abd3
+++ Host - End +++

1 answer

0


Apparently the sed would solve in a simple way this example you gave:

sed s/,,//g

Assuming the text format is:

+++ Host - Begin +++,,
Name,Description
test1,abc2
test2,abd3
+++ Host - End +++,,

Removing all "," from the text:

cat meuarquivo.csv | sed s/,,//g
# ou
sed s/,,//g meuarquivo.csv
  • I forgot to ask, are you using Windows or Linux?

  • I’m using Windows, already solved the problem in question. when I run the command, in the terminal the file appears to me without such ",," but does not save the changes to the file

  • Then you need to save the output result, maybe adding > at the end of the resolve command: sed s/,//g myfile.csv > newfile.csv

Browser other questions tagged

You are not signed in. Login or sign up in order to post.