how to list files with certain pattern


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to list files with certain pattern
# 1  
Old 02-19-2009
how to list files with certain pattern

Hi
I have files in the following naming convention, for example,
/t1/bin/asrv270
/t1/bin/asrv270.sav
/t1/bin/asrv2392.px2392.has_been_deleted.sav
/t1/bin/asrv2713.sav.sav
etc...
The number after "asrv" is different. I need to list only the files which end up with the number, for example,
/t1/bin/asrv2
/t1/bin/asrv26
/t1/bin/asrv3454
etc...
Thanks a lot for any advice.... -A
# 2  
Old 02-19-2009
one way:
Code:
ls /t1/bin/asrv* | grep '[0-9]$'

# 3  
Old 02-19-2009
Thanks a lot
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

List files of arbitrary depth according to a given pattern

I would like to list all the .c and .h files in the current directory or any of its subdirectories. I tried ls -R *.c *.h or ls -R | *.c *.h but that doesn't work. A related question : how to copy all the .c and .h files in the current directory or any of its subdirectories into another... (3 Replies)
Discussion started by: jakezkerrien
3 Replies

2. Shell Programming and Scripting

Rename files to match file list pattern

Hi All, I have 100 folders with the first delimiter has a unique name i.e (123_hello and 575_hello) and each folder have atlist 1000 plus files with naming convention i.e (575_hello_1.iso ... 575_hello_1000.iso). 575_hello/575_hello_1.iso 575_hello/575_hello_2.iso 575_hello/575_hello_3.iso... (8 Replies)
Discussion started by: lxdorney
8 Replies

3. UNIX for Dummies Questions & Answers

List only files based on a pattern

Hi Gurus, I need to list only the files with out certain extension. For eg from the following list of files: I need to only list: Thanks Shash (7 Replies)
Discussion started by: shash
7 Replies

4. Shell Programming and Scripting

list files with a specific pattern

How can I list files with the following specific criteria? I am trying this $> ls *.log or $>ls *.log? --> but it only gives me fsaffa.log1, rwerw.log2. How can I get all three files with a simple selection criteria ? (5 Replies)
Discussion started by: kchinnam
5 Replies

5. UNIX for Dummies Questions & Answers

Script to list non matching files using pattern

Hi, I am trying to write a script that list down all the files that do not match the pattern My pattern will be like this "*.jpg|*.xml|*.sql". This pattern will be stored in a file. The script need to read this pattern from the file and delete the files that does not match this pattern. It... (7 Replies)
Discussion started by: meenavin
7 Replies

6. Shell Programming and Scripting

Find required files by pattern in xml files and the change the pattern on Linux

Hello, I need to find all *.xml files that matched by pattern on Linux. I need to have written the file name on the screen and then change the pattern in the file just was found. For instance. I can start the script with arguments for keyword and for value, i.e script.sh keyword... (1 Reply)
Discussion started by: yart
1 Replies

7. UNIX for Dummies Questions & Answers

copying a pattern of files in one directory into other with new pattern names...

Hi, I have to copy a set of files abc* in /path/ to /path1/ as abc*_bkp. The list of files appear as follows in /path/: abc1 xyszd abc2 re2345 abcx .. . abcxyz I have to copy them (abc* files only) into /path1/ as: abc1_bkp abc2_bkp abcx_bkp .. . (6 Replies)
Discussion started by: new_learner
6 Replies

8. Shell Programming and Scripting

using sed to replace a pattern in list of files

Hi All, using the below grep command,I get the following output: $grep -irl "bc" /home/applmgr/amit > file_list.log $cat file_list.log /home/applmgr/amit/xyz.log /home/applmgr/amit/abc.log Requirement ========= Need sed utility to replace "bc" with "xy" pattern in the list of files... (4 Replies)
Discussion started by: a1_win
4 Replies

9. UNIX for Dummies Questions & Answers

List files that do not match the search pattern

I need to list the files that do not match the search pattern: Example: cat file1 This is how it should work cat file2 This is why I like Unix grep -option? Unix * (or some other command) returns file1 (7 Replies)
Discussion started by: olapxpert
7 Replies

10. IP Networking

List files that do not match the search pattern

I need to list the files that do not match the search pattern: Example: cat file1 This is how it should work cat file2 This is why I like Unix grep -option? Unix * (or some other command) returns file1 (1 Reply)
Discussion started by: olapxpert
1 Replies
Login or Register to Ask a Question