The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 06-26-2006
er_aparna er_aparna is offline
Registered User
  
 

Join Date: Feb 2006
Posts: 52
Hi

I was able to do what i wanted by the following script
ls -ltr *.vmem |tr -s " " ";" |cut -d";" -f9 |sort -n > list_vmem
var1=`tr -s '\n' ' ' < list_vmem`
var2=`tr -s '\n' ',' < list_vmem`
echo $var2 > output_vmem.csv
paste -d"," $var1 >> output_vmem.csv
ls -ltr *.mem |tr -s " " ";" |cut -d";" -f9 |sort -n > list_mem
var1=`tr -s '\n' ' ' < list_mem`
var2=`tr -s '\n' ',' < list_mem`
echo $var2 > output_mem.csv
paste -d"," $var1 >> output_mem.csv
ls -ltr *.cpu |tr -s " " ";" |cut -d";" -f9 |sort -n > list_cpu
var1=`tr -s '\n' ' ' < list_cpu`
var2=`tr -s '\n' ',' < list_cpu`
echo $var2 > output_cpu.csv
paste -d"," $var1 >> output_cpu.csv



But can soembody PLs suggest one line solution for multiple files to be paste coulmn wise when we dont know the number of files to be pasted......

Thanks