Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running the 'exec' feature of 'find in AWK 1

Status
Not open for further replies.

jping45

Technical User
Aug 22, 2001
49
US
I am having issues with running the exec part of the find command in my AWK script.. Any Ideas?


while ((getline < filename) > 0) {
test[a]=$2
system(&quot;find &quot;test[a]&quot; -type f -ctime +3 -exec rm -f {} ';' &quot;)
print test[a]
}


 
This worked for me.

nawk 'system (&quot;find &quot; $2 &quot; -type f -exec rm -f {} \\;&quot;)' filename

I left out the -ctime +3 because I didn't have a file more than 3 days old that I wanted to remove. I used nawk because awk on my system does not have the system command.

Hope this helps.

CaKiwi

After all is said and done, a lot more will have been said than done.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top