![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to clear the content of a pipe (STDIN) after it is written to another program? | vvaidyan | High Level Programming | 10 | 05-15-2008 04:08 PM |
| AIX 5.3 - There is no process to read data written to a pipe | vigsgb | UNIX for Advanced & Expert Users | 4 | 06-21-2006 01:09 AM |
| Clean file in single action | djp | Shell Programming and Scripting | 1 | 06-19-2006 02:34 PM |
| Checking a file is not being written to | kanejm | Shell Programming and Scripting | 14 | 01-20-2006 04:29 AM |
| File being used/written | sanjay92 | UNIX for Dummies Questions & Answers | 4 | 10-13-2001 10:31 AM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Perform action file name written to the pipe
Hello,
I have a script that monitors files uploaded via ftp. After a successful upload, the file name is written to the pipe. There is another program that reads this pipe and allows automatically run any program or script ( say test.sh ) to process the newly uploaded file. cat test.sh ############# mail -s mail -s "New upload : $1" test@test.tld will email the filename to external email address. now in test.sh I want to perform multiple functions: 1) email the uploaded file name ( which is done above ) 2) grep/awk etc, for a string or word in the uploaded file and then if the exact word or string is found then do grep -nr "$pattern" $1 echo " Following pattern found in file" $1 at line number >> /root/upload.log /bin/rm -fr $1 else echo "File safe: " $1 >> /root/upload.log Now the pattern or word can be anyone of the following: porn viagara cannibal maneater herbivore verygood millioniare donkey so pattern is something like pattern='porn|viagara|cannibal|maneater|herbivore|verygood|millioniare|donkey' Please advise. Thanks |
| Forum Sponsor | ||
|
|