LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-29-2008, 01:58 PM   #1
kasthana
LQ Newbie
 
Registered: May 2008
Posts: 7

Rep: Reputation: 0
Question 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
 
Old 05-29-2008, 02:06 PM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
What about this?
Code:
ls -1 Pro.log?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
grep/egrep logical AND function? boozer_2 Linux - Newbie 11 04-10-2010 02:19 AM
using grep and egrep in the terminal KumARan23 Linux - Newbie 3 11-11-2007 10:27 AM
diffrence between grep, sed, awk and egrep Fond_of_Opensource Linux - Newbie 3 08-18-2006 09:15 AM
egrep/grep regex question buldir Programming 7 05-08-2006 08:17 PM
Using Grep and Egrep linux-nerd Linux - General 5 10-10-2004 12:37 PM


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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration