Exclude a file or not in


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Exclude a file or not in
# 1  
Old 05-31-2012
Bug Exclude a file or not in

Hi Gurus.

I have a directory and i receive many files with extension .log. I processed the file as i get it. i want to process all the files except one which i know i don't want to process.

Code:
cd /backup/temp/rajesh/PACS #--- directory , under this i have below files
PACS_WEB_Q36-RNH_20120530103802.log
PACS_WEB_Q36-RNH_20120530103803.log
PACS_WEB_Q36-RNH_20120530103803.log

and pacsnew.log .

pacsnew.log is the one is system generated and i dont want to process.

When my loop statrt it picks pacsnew.log as well.

Code:
#if [$? ne 0]; then
if [ -f *.log ]
then
  for i in *.log
  do
     flnm=$i

can you please help me to excude the file in loop and processed the rest

Last edited by Scott; 05-31-2012 at 06:05 AM.. Reason: Code tags, please...
# 2  
Old 05-31-2012
Code:
 
for i in PACS_WEB_*
do
    echo "$i"
    #Do your processing here
done

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to get number on file exclude varchar?

hallo, yould you guys help me? im using bash script i have file getnumber.csv cat getnumber.csv 234198 654639 eht4v4 453nbddme 43 455fr i try this cat getnumber.csv | sed 's/*//g' but the result is : 234198 (5 Replies)
Discussion started by: kivale
5 Replies

2. Shell Programming and Scripting

Find and exclude what is in file

Hello everyone, I try to find folders older than 3 years and display them, but excluding some directories, the below code does NOT exclude listed directories: find . -maxdepth 3 -mtime +1095 -type d -exec ls -l {} \; | grep -vFf oldExclude >> older oldExclude Folder1/ Folder2/... (7 Replies)
Discussion started by: Abu Rayane
7 Replies

3. Shell Programming and Scripting

Exclude variable from a file

Hello, I have a list of patterns which I'd like to exclude from a file. I tried to do while read line do grep -v $line file >> new.file done < mylist But obviously it won't work. It only works for just grep. I know I can do: grep -Ev 'pattern1|pattern2|...' myfile but my... (7 Replies)
Discussion started by: coppuca
7 Replies

4. Shell Programming and Scripting

To exclude users in password file

Hi, I want to exclude the users below 500 in the password file with the below script. #!/bin/bash # get date in dd-mm-yyyy format NOW=$(date +"%d-%m-%Y") exec > "/root/SYSINFO/User_details_`uname -n`_$NOW.txt" cut -d: -f1 /etc/passwd > /tmp/pass.txt && for i in `cat /tmp/pass.txt`;... (2 Replies)
Discussion started by: gsiva
2 Replies

5. UNIX for Dummies Questions & Answers

Exclude file with tar

hi, i am trying to use a exclude file to exclude some file directories while making a tar archive. This is my command: tar -pcvf orahome10gR2.tar.gz db_1 -X /home/oracle/excludeFile.txt /home/oracle/ when i execute it, it seem to be tar-ing. But once is done, i cd to /home/oracle and could... (2 Replies)
Discussion started by: redologger
2 Replies

6. Ubuntu

[Solved] Using Find with an exclude/exclude file

I am familiar with using tar and exclude/include files: tar zcf backup.dirs.tgz --files-from=include.mydirs --exclude-from=exclude.mydirs --no-recursion but was wondering if I could use find in the same way. I know that you can just specify the directories to exclude but my list is... (2 Replies)
Discussion started by: metallica1973
2 Replies

7. Shell Programming and Scripting

Have to exclude the first and last line of the file : help me

hi , i am very new to perl . scriptting.. pllease can any one help me ...pleaseeeeeee i ll have a file which look likes 123 |something |567 456 |welcome |789 457 |inboxpost |790 . . 123 |something |567 i have to execute all the lines in the file except the first and the... (14 Replies)
Discussion started by: vishwakar
14 Replies

8. Shell Programming and Scripting

ls to exclude file

I have cgicsave.env and cgic*, but I want to print cgic* value but NOT cgicsave.env Thanks (9 Replies)
Discussion started by: xs2punit
9 Replies

9. Shell Programming and Scripting

How to exclude certain colomn from the file?

Hi I have a file in the following format: 4135 f4135acc: 39798 rmtdb: 0 /t1/data/f4135acc.dta 4135 f4135pdb: 39795 rmtdb: 0 /bb/data/f4135pdb.dta 4135 p4135eng: 0 rmtdb: 0 /bb/bin/p4135eng 4135 r4135eng: 14142 rmtdb: 0 ... (6 Replies)
Discussion started by: aoussenko
6 Replies

10. Shell Programming and Scripting

how to exclude file when changing permission

I have files as below: erf100.sh erf101.sh erf102.sh erf103.sh erf104.sh erf105.sh I can easily change permission of all files to 755 by issuing command below: chmod 755 erf*.sh; how do i change permission of all files but excluding file erf102.sh? thanks best regards (2 Replies)
Discussion started by: khchong
2 Replies
Login or Register to Ask a Question