merging two file in an ordered way

actually, it seems somewhat confusing.. let me clearify it

i want a file having all the attributes produced by ls -lc command. i want to add one more thing i.e. time of last access to a file attribute. so how can i merge these two things in a single file in a columnar way.

i tried with these but didn't helped actually

ls -lu > file_with_last_access_time

awk -F" " '{print $8}' file_with_last_access_time > last_access_time
//just grab the last acces time attribute from file_with_last_access_time

ls -lc | sort -m last_access_time - > final_file
// lists all attributes of the directory (including last modified time) and merge it with last access time

well, it worked but the things were in the bottom, i want them in the last column...

plz help me

I really don't understand exactly what you want but this may help:

find . -maxdepth 1 -printf "%A@ %AT %CT %P\n" | sort -k1,1n

To my understanding u wish to have listing of both time stamps in one listing.

To achieve this:

ls -lu | sort +8 >> /tmp/file1
ls -lc | sort +8 >> /tmp/file2
paste /tmp/file1 /tmp/file2 | awk '{print $1,$2,$3,$4,$5,$6,$7,$8,$9,$17}' | sed -e '1d'

I know it is not the best solution...but hope it helps :wink:

rishi