I have executed the below command:
find . -name "Ks*" -type f -exec ls -ltr {} \; | awk '{printf("%ld %s %d %s \n",$5,$6,$7,$8,$9)}'
and here is the output:
1282 Oct 7 2004
51590 Jul 10 2006
921 Oct 7 2004
1389 Jun 4 2003
1037 May 19 2004
334 Mar 24 2004
672 Jul 8 2003
977 Apr 1 2004
I want to display the name of the file and the directory where the file exists including the above output
Desired output:
same output + directory + filename
Thanks in advance...
Regards,
Venkat.
Specify the full path and you'll get the desired ouput:
find /full/path/here -name "Ks*" -type f -exec ls -ltr {} \; | awk '{printf("%ld %s %d %s \n",$5,$6,$7,$8,$9)}'
hkansal
3
I think u missed a %s in your awk.
Thank you, but am getting a different output which i don't expect:
921 Oct 7 /opt/Scripts/KsGenerateSkuInvPix.sh
1389 Jun 4 /opt/Scripts/KsPurgeC_command_database.cfg
I just need the above output + directory in a separate column (no need to display the absolute path) + filename in a separate column
Hope i explained clearly.
Thanks,
Venkat.
hkansal
5
for the following:
921 Oct 7 /opt/Scripts/KsGenerateSkuInvPix.sh
should the o/p be:
921 Oct 7 Scripts KsGenerateSkuInvPix.sh
Please tell if I ve followed you correctly!
not sure try this
find . -name "Ks*" -type f -exec ls -ltr {} \;|awk -F"[ /]" '{print $17" "$18" "$19" "$22" "$23}'
Thanks a lot for your help... but when i executed the above command , i just got blank output.
yes hkansal...
the desired output: 921 Oct 7 2004 Scripts KsGenerateSkuInvPix.sh