I have 178 files with an extension _count and I want to use paste command with the name of the file as the header, say
File1_count
abc
def
gfh
FILE2_count
ijk
lmn
opq
FILE3_count
rst
uvw
xyz
.... FILE178_count
123
456
789
such that when I do paste *_count I will get the headers with the paste command as
FILE1 FILE2 FILE3 .... FILE178
abc ijk rst 123
def lmn uvw 456
gfh opq xyz 789
you'll have to rewrite (or make temp copies) to include the fileName as the header. for f in FILE* ; do { echo "$f" ; cat $f ; } >$f.tmp && mv $f.tmp $f
amd then your paste cmd. I think file1 file11 file111 will be the first 3 columns (for example), so better check that out first. You'll need to renamed files as file0001
to get a clean list Good luck.
– shellter
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With