Hello,
I need few clarification in types of paste command ussage in coulmn mode :
In a directory i have few file distinguished as *.cpu *.vmem and *.mem
and have coulmn entries like
first cpu file
89576
89576
89576
89576
89576
89576
89576
second cpu file
46312
46312
46312
46312
46312
46312
46312
46312
46312
and third cpu file
46392
46392
46392
46392
46392
46392
and i want my output as
first file,second file, third file
89576,46312,46392
89576,46312,46392
89576,46312,46392
89576,46312,46392
89576,46312,46392
89576,46312,46392
i can do it easily by paste command paste -d"," first cpu file second cpu file third cpu file > output
but i dont know how many number of files there are for cpu extn....
i wrote a script :
ls -ltr |tr -s " " ";" |cut -d";" -f9 |egrep "(.cpu$|.vmem$|.mem$)" > temp1
cut -d"." -f1,2 temp1 |sort -u |> temp2
for var in `cat temp2`
do
paste -d"," $var" >> out
done
But it will paste the file i same coulmn:
Pls suggest possible one line command for it .I think using nawk or
sed i can do it but i amd not having good Knowledge of them ...
thanks in advance
Aparna