Closed MostafaYA closed 1 year ago
The result of echo -ne "1\t2\t3\t4\na\tb\n"
is not a valid TSV file.
If they are, use csvtk concat.
You can fix the TSV file with code from @lskatz :
for i in *.tsv; do \
tabs=$(cat $i | perl -F'\t' -lane 'print(scalar(@F))' | sort | uniq | sort -nr | head -n 1); \
cat $i | perl -F'\t' -lane 'while(@F < '$tabs'){push(@F,"");} print join("\t", @F);' > tmp.tsv && mv -v tmp.tsv $i; \
done;
The new csvtk fix
is v0.26.0 can also fix this.
$ echo -ne "1\t2\t3\t4\na\tb\n" | csvtk fix -t | csvtk pretty -Ht -S bold
[INFO] the maximum number of columns in all 2 rows: 4
┏━━━┳━━━┳━━━┳━━━┓
┃ 1 ┃ 2 ┃ 3 ┃ 4 ┃
┣━━━╋━━━╋━━━╋━━━┫
┃ a ┃ b ┃ ┃ ┃
┗━━━┻━━━┻━━━┻━━━┛
Prerequisites
csvtk version
Describe your issue
desired output
Thank you
I'm grateful to users who have greatly helped to report bugs and suggested new features.
I may respond to issues or fix bugs quickly, but I usually implement new features periodically (two or more weeks).