![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Pattern Matching problem in UNIX | maxmave | Shell Programming and Scripting | 2 | 06-03-2008 01:19 AM |
| problem with CASE pattern matching | gummysweets | Shell Programming and Scripting | 2 | 03-18-2008 11:30 AM |
| pattern matching in an if-then | lumix | Shell Programming and Scripting | 4 | 12-14-2007 04:25 PM |
| pattern matching problem | rein | Shell Programming and Scripting | 8 | 10-26-2007 11:44 PM |
| Pattern Matching | danhodges99 | UNIX for Dummies Questions & Answers | 2 | 02-27-2003 03:03 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
pattern matching problem
Code:
FilesToBackup='*.track* *.xml *.vm* *.gz Trace* TRACE* "*core*" *.out fcif_data_* esi_error_* *.rollback *.sed R.* APStatus_*
log* *.output* send_mail* downenv* check_env* intaspurge_db_* sqlnet.log *.rpt *.html *.csv "*TSC*"'
and i am using it like this-
echo Moving files from $(pwd):
filesclause=$(/bin/echo "$FilesToBackup" | sed -e "s/ /\' -o -name \'/g")
filesclause="-name '$filesclause'"
# The following find will search the current dir and all subdirs except only name "centers"
# Each file that is older than 1 day will be checked against the $FilesToBackup list
# Those that match will be added to the tmpfile intasclean$$
if [[ $dir != "." ]]; then
eval find . -type f \\\( $filesclause \\\) | grep -v "^./centers" > $TEMPDIR/intasclean$$
else
echo $FilesToBackup | xargs /bin/ls -1 > $TEMPDIR/intasclean$$ 2>/dev/null
fi
Thanks... |
|
||||
|
Hi Namish,
Use the following to take backup of your files(or you can use 'mv' to move the files) #*********************** #!/bin/bash FILENAMES="*.track* *.xml *.vm* *.gz Trace* TRACE* "*core*" *.out fcif_data_* esi_error_* *.rollback *.sed R.* APStatus_* log* *.output* send_mail* downenv* check_env* intaspurge_db_* sqlnet.log *.rpt *.html *.csv *TSC*" for i in $FILENAMES do echo $i find /path/to/search/directory/ -name "$i" -exec cp {} /path/to/backup/directory/ \; done exit 0 #****************************************************** Regards, Vinod |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|