LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Help with ls and grep/egrep (https://www.linuxquestions.org/questions/linux-newbie-8/help-with-ls-and-grep-egrep-645637/)

kasthana 05-29-2008 12:58 PM

Help with ls and grep/egrep
 
I have following files in a directory

Pro.log Pro.log1 Pro.log14 Pro.log55
Pro.log.2008-05-18 Pro.log10 Pro.log2 Pro.log6
Pro.log.2008-05-19 Pro.log11 Pro.log3 Pro.log7
Pro.log.2008-05-20 Pro.log12 Pro.log4 Pro.log8
Pro.log.2008-05-21 Pro.log13 Pro.log5 Pro.log9

I want to find only the files which are without date format and in the range of 5-9 ; output should be as

Pro.log5
Pro.log6
Pro.log7
Pro.log8
Pro.log9


I Tried various combinations and the closest I could reach was with

ls | egrep [Pro.log] | egrep [5-9] |egrep -v [-^]

but its also showing Pro.log55 in output.

Please help!!

Thanks

colucix 05-29-2008 01:06 PM

What about this?
Code:

ls -1 Pro.log?


All times are GMT -5. The time now is 02:08 AM.