简体   繁体   English

Unoconv用值填充合并的单元格

[英]Unoconv fill merged cells with value

I am using unoconv to convert different xlsx reports into csv. 我正在使用unoconv将不同的xlsx报告转换为csv。 One of the reports has a merged cell like below. 报告之一具有如下所示的合并单元格。

Column_1   Column_2  Column_3  Column_4
C          ABC       DEF       123
           ABC       DEF       123
           ABC       DEF       123

Whenever I convert the xlsx file into csv. 每当我将xlsx文件转换为csv时。 The merged cell which is column_1 is not filled with values like this. 合并的单元格(即column_1)未填充此类值。

Column_1,Column_2,Column_3,Column_4
C,ABC,DEF,123
,ABC,DEF,123
,ABC,DEF,123

Is there any option in unoconv to fill the merged cells with value? unoconv中是否有任何选项可以用值填充合并的单元格? Or is there any possible work around with this using awk maybe? 还是有可能使用awk解决此问题?

Desired Ouput: 所需的Ouput:

Column_1,Column_2,Column_3,Column_4
C,ABC,DEF,123
C,ABC,DEF,123
C,ABC,DEF,123

跟随awk可能会帮助您。

awk 'FNR==1{$1=$1;print;next} !/^ +/{val=$1;$1=$1} /^ +/{$1=val OFS $1} 1' OFS=","   Input_file

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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