简体   繁体   中英

Bash - How to skip a column while writing to csv

In the following screenshot as you can see on the first row, there are country codes and for each country code with have two different related columns (MT & MO). how do I skip adding a empty column after each country using bash script?

在此处输入图片说明

Here is how I write the countries row:

echo "'SG',,'ID',,'AU',,'MY',," >> ${fileName}

as you can see there are ,, in between the country codes to facilitate the reading the output but is there any way to skip adding column to end up having the whole column for each country? I need something like this:

在此处输入图片说明

Please advice,

The CSV format does not provide any way to indicate that a cell spans several columns. In fact, it doesn't provide any way to indicate formatting of any kind.

So if you are restricted to using CSV, you cannot do better than inserting an empty cell.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM