I have a .CSV file with over 500,000 lines that I need to:
- find all 'space double quote space' sequences and replace with nothing
- find all 'space double quote' sequences and replace with nothing
- find all double quotes and replace with nothing
Example of .CSV line:
"DISH Hartford & New Haven (Hartford)", "206", "FBNHD", " 06028", " East Windsor Hill", "CT", "Hartford County" ** Required output**
DISH Hartford & New Haven (Hartford),206,FBNHD,06028,East Windsor Hill,CT,Hartford County I need to remove all double quotes (") and spaces in front of and behind the commas (,).
I've tried
$ cd /Users/Leonna/Downloads/ $ cat bs-B2Bformat.csv | sed s/ " //g This gives me the 'command incomplete' greater than prompt, so I then tried:
$ cat bs-B2Bformat.csv | sed s/ " //g sed: 1: "s/": unterminated substitute pattern $ cat bs-B2Bformat.csv |sed s/ \" //g sed: 1: "s/": unterminated substitute pattern $ There are too many lines for me to edit in Excel (Excel won't load all the lines) or even a text editor. How can I fix this?
sedscripts in single quotes. For example:sed 's/ " //g'. The only time you don't do that is … perhaps … when the command itself needs to contain single quotes, though then you're usually better off writing each literal single quote as'\'', so you might writesed 's/ '\'' //g'.