LinuxQuestions.org
Register a domain and help support LQ
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 10-28-2010, 12:30 AM   #1
adshocker
LQ Newbie
 
Registered: Apr 2008
Posts: 10

Rep: Reputation: 0
Finding files with filename format


hi all,

i'm trying to find out how to show files having a particular format. i.e.

files
o570345.out
o5703451.out
XX_570345_1.RTF

so when i search for files using
ls *570345*

it shows all three files but actually i don't like to see the second file o5703451.out because 5703451 is different from 570345. how do i go about this?

thanks
 
Old 10-28-2010, 12:47 AM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
Originally Posted by adshocker View Post
hi all,

i'm trying to find out how to show files having a particular format. i.e.

files
o570345.out
o5703451.out
XX_570345_1.RTF

so when i search for files using
ls *570345*

it shows all three files but actually i don't like to see the second file o5703451.out because 5703451 is different from 570345. how do i go about this?

thanks
So is "XX_570345_1.RTF" ... can you come up w/ more
specific rules? At the end of the day you'll need to
filter stuff out, either using grep or some funky
bash ways :}


Cheers,
Tink
 
Old 10-28-2010, 01:27 AM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,425

Rep: Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826Reputation: 2826
Assuming the only exception is no number:
Code:
ls *570345[^0-9]*
 
1 members found this post helpful.
Old 10-28-2010, 01:54 AM   #4
adshocker
LQ Newbie
 
Registered: Apr 2008
Posts: 10

Original Poster
Rep: Reputation: 0
hi,

thanks for the replies.. basically the rule is the 570345 is actually an id of a particular request. and a request may have more than 1 output like in the example.. output naming conventions will contain the request id (570345 in the example) but will not have a number before or after the request id.. so for the request id 570345, it can have outputs like:

o570345.out
o570345.req
XX_570345_1.RTF

if there is another request id 5703451 then this request can produce outputs like:
o5703451.out
o5703451.req
XX_5703451_1.PDF

but what i want is to search for all outputs given a request id (570345 in the sample) and it should give me the following:
o570345.out
o570345.req
XX_570345_1.RTF

thanks.
 
Old 10-28-2010, 02:01 AM   #5
adshocker
LQ Newbie
 
Registered: Apr 2008
Posts: 10

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by grail View Post
Assuming the only exception is no number:
Code:
ls *570345[^0-9]*
this seems to be doing the trick. i'll do some more testing and get back to you.

thanks.
 
  


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
change the filename using qmail in Maildir format packets Linux - Server 0 11-23-2009 11:12 PM
How to convert rm format music files to mp3 format me4linux Linux - Software 2 05-15-2007 02:45 PM
change uploaded files from filename.avi to filename.avi.html like www.rapidshare.de latheesan Linux - Newbie 3 06-16-2005 05:33 AM
filename- and filename~ files? slinky2004 Linux - Newbie 5 10-17-2004 11:32 PM
Changing format of filename when ripping cd's with konqueror JHuizingh Linux - Software 2 07-31-2003 03:14 AM


All times are GMT -5. The time now is 04:51 PM.

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