The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Need a regular expression tony3101 Shell Programming and Scripting 4 06-05-2008 04:13 AM
regular expression jaber87 Shell Programming and Scripting 3 06-05-2008 04:07 AM
regular expression and awk nickg UNIX for Dummies Questions & Answers 2 08-16-2007 06:23 PM
help in regular expression Rakesh Ranjan High Level Programming 5 10-25-2006 02:00 PM
Regular Expression + Aritmetical Expression Z0mby Shell Programming and Scripting 2 05-21-2002 11:59 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-18-2007
andy2000 andy2000 is offline
Registered User
  
 

Join Date: Mar 2007
Posts: 36
regular expression...help!!

how to list all text files except the files from 20070712:

abc_20070710_123.txt
abc_20070711_123.txt
abc_20070712_123.txt

ls *.txt | egrep"[a-z]+_^20070710_[0-9]+\.txt"

Any idea please!!


Andy
  #2 (permalink)  
Old 07-18-2007
kamitsin's Avatar
kamitsin kamitsin is offline
Registered User
  
 

Join Date: Nov 2006
Location: /dev/null
Posts: 177
Code:
ls *.txt|grep -v 20070712
  #3 (permalink)  
Old 07-18-2007
andy2000 andy2000 is offline
Registered User
  
 

Join Date: Mar 2007
Posts: 36
kamitsin, how to solve the problem in "regular expression" not with grep -v ???
  #4 (permalink)  
Old 07-18-2007
lorcan lorcan is offline
Registered User
  
 

Join Date: May 2007
Posts: 219
Do you want an exact pattern that matches the files like "abc_20070710_123.txt" ?

Or do you want to use sed instead of grep -v

Code:
ls *.txt | sed '/20070712/d'
  #5 (permalink)  
Old 07-18-2007
andy2000 andy2000 is offline
Registered User
  
 

Join Date: Mar 2007
Posts: 36
lorcan,

>Do you want an exact pattern that matches the files like "abc_20070710_123.txt" ?

yes that what I need.

Thank you

Andy
  #6 (permalink)  
Old 07-18-2007
lorcan lorcan is offline
Registered User
  
 

Join Date: May 2007
Posts: 219
Note this is just the pattern you have asked for. And if you do not want to list the files with the pattern "20070712" you have to follow either the two methods mentioned above.

Hope this helps

Pattern

Code:
^abc_[0-9]\{8\}_[0-9]\{3\}\.txt$
or to generalize

Code:
^[a-z]\{3\}_[0-9]\{8\}_[0-9]\{3\}\.txt$

Last edited by lorcan; 07-18-2007 at 07:13 AM..
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:23 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0