Skip to main content
16 events
when toggle format what by license comment
Jun 16, 2022 at 16:08 vote accept Mr. Underscore
May 7, 2021 at 22:30 answer added Ed Morton timeline score: 2
May 6, 2021 at 8:23 answer added Carlos Pascual timeline score: 2
May 6, 2021 at 4:12 answer added cas timeline score: 1
May 5, 2021 at 18:40 answer added glenn jackman timeline score: 2
May 5, 2021 at 17:08 review Close votes
May 10, 2021 at 3:04
May 5, 2021 at 17:02 comment added terdon If your file doesn't contain a header, please remove it. We cannot guess what your file looks like. You need to make sure that your example is actually an accurate representation of your data otherwise our solutions won't work. So far, we think you have files with exactly 2 lines, where the first line should not be changed but the second should.
May 5, 2021 at 17:02 comment added steeldriver At least with sed, it's going to be easier to replace the one "rogue" delimiter rather than replace all the "good" ones - you can always swap them after ex. sed -e '1!s/,/|/5' -e 'y/,|/|,/' bad.csv
May 5, 2021 at 17:00 answer added terdon timeline score: 2
May 5, 2021 at 16:58 comment added Mr. Underscore Header is mentioned here just for the explanation. The commas are only coming in the Address Column. The solution I am looking for is to change delimiter of first 4 columns and last 2 columns. This is the best approach in my mind as in this way commas in the address column will not get replaced. The solution I mentioned here needs a little bit of tweaking as that solution almost does the job but only removes the commas in the address column.
May 5, 2021 at 16:56 history edited terdon CC BY-SA 4.0
your example has 7 fields, not 10
May 5, 2021 at 16:50 comment added terdon Also, can we just assume that any , that comes before a space should not be considered a delimiter?
May 5, 2021 at 16:48 comment added terdon Do you really not want to change the delimiter for the header? That will make any subsequent processing very hard. Also, how can we know which , to keep and which , to replace with |? Can we safely assume that if the current line has >10 fields, then we need to consider the 5th , as non-delimiter?
May 5, 2021 at 16:46 history edited terdon CC BY-SA 4.0
Fixed formatting; removed mention of the shell: this isn't related to the shell, you are using tools like awk and sed, not the shell.
May 5, 2021 at 16:26 review First posts
May 13, 2021 at 21:46
May 5, 2021 at 16:24 history asked Mr. Underscore CC BY-SA 4.0