![]() |
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 |
| sed redirection | myle | UNIX for Dummies Questions & Answers | 3 | 03-12-2008 07:04 PM |
| csh stderr redirection | jolok | Shell Programming and Scripting | 0 | 04-15-2005 10:03 AM |
| I/O redirection within a coprocess | Mugin | Shell Programming and Scripting | 4 | 10-21-2003 08:17 AM |
| Help with redirection | Shallon1 | High Level Programming | 2 | 12-12-2001 07:35 AM |
| redirection to tty** with cat | zorro | UNIX for Dummies Questions & Answers | 1 | 11-02-2001 11:23 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | 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
|
|
||||
|
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
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|