madurai1968
IS-IT--Management
I am using command ls -l | grep ^- and this list only the files in the directory
But actually, I wanted to have only the list all the files present in the directory to a file and then use it in for loop in shell script.
If i use,
ls -l|grep ^- >pickfile
then i would have something like below in the pickfile.
-rw-r--r-- 1 ediusrd edi 20 Sep 24 15:49 cos00878_97878
-rw-r--r-- 1 ediusrd edi 20 Sep 24 15:21 cos00008676_45630
I wanted to have only the file name in the pickfile so that i can use in the for loop ny checking the file, say
cos00878_97878
cos00008676_45630.
something like ls |grep ^- >pickfile. But this does not seem to work.
Do you have some information on this OR do you have any awk/unix pipe commands throught which I can acheive this.
Thank for your time.
But actually, I wanted to have only the list all the files present in the directory to a file and then use it in for loop in shell script.
If i use,
ls -l|grep ^- >pickfile
then i would have something like below in the pickfile.
-rw-r--r-- 1 ediusrd edi 20 Sep 24 15:49 cos00878_97878
-rw-r--r-- 1 ediusrd edi 20 Sep 24 15:21 cos00008676_45630
I wanted to have only the file name in the pickfile so that i can use in the for loop ny checking the file, say
cos00878_97878
cos00008676_45630.
something like ls |grep ^- >pickfile. But this does not seem to work.
Do you have some information on this OR do you have any awk/unix pipe commands throught which I can acheive this.
Thank for your time.