简体   繁体   中英

Unoconv fill merged cells with value

I am using unoconv to convert different xlsx reports into 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. The merged cell which is column_1 is not filled with values like this.

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? Or is there any possible work around with this using awk maybe?

Desired 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

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