![]() |
|
|
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 |
| RegEx for text pattern | rider29 | Shell Programming and Scripting | 6 | 09-01-2009 04:08 PM |
| Searching a pattern in file and deleting th ewhole line containing the pattern | Shazin | Shell Programming and Scripting | 1 | 07-24-2009 12:27 PM |
| sed: Find start of pattern and extract text to end of line, including the pattern | TestTomas | Shell Programming and Scripting | 5 | 05-27-2009 12:16 PM |
| search a pattern and if pattern found insert new pattern at the begining | pitagi | Shell Programming and Scripting | 7 | 02-12-2009 10:27 PM |
| comment/delete a particular pattern starting from second line of the matching pattern | imas | Shell Programming and Scripting | 4 | 10-13-2008 03:37 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
sed to awk (regex pattern) how?
Hello, I am trying to covert a for statement into a single awk script and I've got everything but one part. I also need to execute an external script when "not found", how can I do that ? Code:
for TXT in `find debugme -name "*.txt"` ;do FPATH=`echo $TXT | sed 's/\(.*\)\/\(.*\)/\1/'` how to add it to the following awk code? Code:
find debugme -name "*.txt" | awk 'BEGIN{
while( (getline line < "debug.files" ) > 0 ) {
a[++d]=line
}
close("debug.files")
}
{
filename=$0
#FPATH=?????
while( (getline line < filename ) > 0 ){
f=0
m=split(line,t," ")
if ( t[1] ~ "(rar|r[0-9]+)" ){
for(i=1;i<=d;i++){
if( a[i] ~ t[1] ){
print found
f=1
}
}
if (f==0){ print not found }
}
}
close(filename)
}'
|
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|