![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum 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 |
| sed redirection | myle | UNIX for Dummies Questions & Answers | 3 | 03-12-2008 03:04 PM |
| csh stderr redirection | jolok | Shell Programming and Scripting | 0 | 04-15-2005 07:03 AM |
| I/O redirection within a coprocess | Mugin | Shell Programming and Scripting | 4 | 10-21-2003 05:17 AM |
| Help with redirection | Shallon1 | High Level Programming | 2 | 12-12-2001 03:35 AM |
| redirection to tty** with cat | zorro | UNIX for Dummies Questions & Answers | 1 | 11-02-2001 07:23 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
redirection
Hi,
The code below works, it's a part of a bash shell script that serve to search a pattern $pattern_da_cercare in the files contained in a directory $directory_iniziale. Now the proble is: How can I redirect stderr to a file? PS: so I want to redirect ALL the errors to a file. I tryed to learn how to do it, but I haven't understood Code:
find $directory_iniziale -type f | while read file
do
awk -v min=$MIN -v max=$MAX -v patt=$pattern_da_cercare '
BEGIN{RS=" |\n"; patt = "(^|[^A-Za-z0-9])" patt "([^A-Za-z0-9]|$)" }
$0 ~ patt {n++}
END {
if(n >= min && n <= max && n != 0) {print FILENAME " : " n}
}
' "$file"
done
|
| Forum Sponsor | ||
|
|
|
|||
|
Quote:
Code:
find $directory_iniziale -type f | while read file 2>&1 > conta_occorrenze_log.txt
do
awk -v min=$MIN -v max=$MAX -v patt=$pattern_da_cercare '
BEGIN{RS=" |\n"; patt = "(^|[^A-Za-z0-9])" patt "([^A-Za-z0-9]|$)" }
$0 ~ patt {n++}
END {
if(n >= min && n <= max && n != 0) {print FILENAME " : " n}
}
' "$file"
done
|