Patern Match Question on file names


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Patern Match Question on file names
# 1  
Old 10-15-2008
Patern Match Question on file names

I have a script which I use to archive log files and I want to install it on another server. I match any file with a ".log" in the name. Most files end with ".log" or ".log.nnnn". Of course someone has a file on this server that they do not want to archive that has .login.ear in the file name and my script is picking it up. Any ideas on how to change the find command to bypass this file?

Code:
find /opt/Weblogic/servers/Server1/ -type f -iname  \*.log\* ! -newer /tmp/archive/REF

# 2  
Old 10-15-2008
Code:
find /opt/Weblogic/servers/Server1/ -type f \ 
      \( -iname  '*.log'  -o  -iname '*.log.[:digit:][:digit:][:digit:]*' \)
       ! -newer /tmp/archive/REF

Try using limited sq bracket pattern matching - I used posix, you could use [0-9] instead of [:digit:]
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk to update file based on partial match in field1 and exact match in field2

I am trying to create a cronjob that will run on startup that will look at a list.txt file to see if there is a later version of a database using database.txt as the source. The matching lines are written to output. $1 in database.txt will be in list.txt as a partial match. $2 of database.txt... (2 Replies)
Discussion started by: cmccabe
2 Replies

2. Shell Programming and Scripting

Exclude certain file names while selectingData files coming in different names in a file name called

Data files coming in different names in a file name called process.txt. 1. shipments_yyyymmdd.gz 2 Order_yyyymmdd.gz 3. Invoice_yyyymmdd.gz 4. globalorder_yyyymmdd.gz The process needs to discard all the below files and only process two of the 4 file names available ... (1 Reply)
Discussion started by: dsravanam
1 Replies

3. UNIX for Dummies Questions & Answers

awk question - print columns with names

I found this command and would like to know what it means: gawk 'NR==1{for(i=1;i<=NF;i++)if($i~/FE/)f=i}{for(i=0;i<n;i++)printf"%s%s",i?" ":"",$f;print""}' It seems to mean if the row =1 assign i to that row, and then if FE is in the top row /column then increment and print the row. I am... (2 Replies)
Discussion started by: newbie2010
2 Replies

4. Shell Programming and Scripting

Match pattern1 in file, match pattern2, substitute value1 in line

not getting anywhere with this an xml file contains multiple clients set up with same tags, different values. I need to parse the file for client foo, and change the value of tag "64bit" from false to true. cat clients.xml <Client type"FIX"> <ClientName>foo</ClientName>... (3 Replies)
Discussion started by: jack.bauer
3 Replies

5. UNIX for Dummies Questions & Answers

Grep to find lines matching given patern in a file

When I try with patern matching in a file with below code works cat scj_drive_commands | egrep '/app/oracle/build_lib/pkg32|/app/oracle/build_lib/pkg33' But when I have code with patern searching using of below does not work ! cat scj_drive_commands | egrep... (3 Replies)
Discussion started by: Siva SQL
3 Replies

6. Shell Programming and Scripting

Searching for file names in a directory while ignoring certain file names

Sun Solaris Unix Question Haven't been able to find any solution for this situation. Let's just say the file names listed below exist in a directory. I want the find command to find all files in this directory but at the same time I want to eliminate certain file names or files with certain... (2 Replies)
Discussion started by: 2reperry
2 Replies

7. UNIX for Dummies Questions & Answers

how to deleting except the patern in a file

Hello respected members, I have a file wich has several fields separated by space. I want to remove all the fields which are not the client_name. I mean the field which are not "pfizer","csx" and "mafoi". And the deletion action will be taken place from the 3rd field(including the third... (2 Replies)
Discussion started by: Manabhanjan
2 Replies

8. Shell Programming and Scripting

use python or awk to match names 'with error tolerance'

I think this is a very challenging problem I am facing and I have no idea how to deal with it Suppose I have two csv files A.csv Toyota Camry,1998,blue Honda Civic,1999,blue B.csv Toyota Inc. Camry, 2000km Honda Corp Civic,1500km I want to generate C.csv Toyota Camry,1998,blue... (7 Replies)
Discussion started by: grossgermany
7 Replies

9. UNIX for Dummies Questions & Answers

tar archive with including specific patern files

Hi, I need to create recursive tar archive, while I put there only files of type a*.txt. Without file filtering the command is: tar cfzf test.tar.gz test_tar/ How I include the switch for including only files with pattern a*.txt ? Thanks a lot! (1 Reply)
Discussion started by: john.gelburg
1 Replies

10. UNIX for Dummies Questions & Answers

linux question, pardon, on long file names

Sorry, hope no one minds the linux question here, I use both unix and linux, and have come across a problem. On my linux box i have a dual boot, and i've set it up so i can access my windows data partition while in linux mode (mount the vfat partition), but linux doesn't recognize long file names,... (2 Replies)
Discussion started by: kymberm
2 Replies
Login or Register to Ask a Question