|
google site
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Users | 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. |
![]() |
|
|
Search this Thread |
|
#1
|
||||
|
||||
|
awk search & delete located criteria
Guys, I manages to get awk to search and print the files that I want to delete. However I am stuck on the delete portion. Here is the command that I am using to fins these files. Code:
find /usr/local/apache/conf/vhosts/ -type f | awk '/e$/' The output is perfect. The files look like so: Code:
/usr/local/apache/conf/vhosts/kydzradiolv.com\e /usr/local/apache/conf/vhosts/stylefm.kyee /usr/local/apache/conf/vhosts/foxcountry.useee /usr/local/apache/conf/vhosts/old2-rooster101.kyee /usr/local/apache/conf/vhosts/foxcountry.usee /usr/local/apache/conf/vhosts/rooster101.kyee /usr/local/apache/conf/vhosts/itm-eee /usr/local/apache/conf/vhosts/king.orgeee /usr/local/apache/conf/vhosts/old2-z99.kyee /usr/local/apache/conf/vhosts/cjcy.loungeradio.caeee /usr/local/apache/conf/vhosts/charityawardsprogram.useee I want all of the findings deleted. I have tried the following with no luck: Code:
find /usr/local/apache/conf/vhosts/ -type f | awk '/e$/d' Any ideas? Jaysunn |
| Sponsored Links | ||
|
|
|
#2
|
|||
|
|||
|
Code:
find /usr/local/apache/conf/vhosts/ -type f | awk '/e$/{system("rm " $0)}' |
|
#3
|
||||
|
||||
|
Why not Code:
find /usr/local/apache/conf/vhosts/ -name "*e" -type f -exec rm {} \; |
|
#4
|
|||
|
|||
|
Quote:
![]() |
|
#5
|
||||
|
||||
|
[solved]
Hmm @dennis.jacob,
I thought that I needed the $ to anchor all the end e's. But your solution is correct. Thanks. Jaysunn |
| Sponsored Links | ||
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Search and delete | ak835 | Shell Programming and Scripting | 1 | 01-25-2010 08:59 AM |
| Delete new lines based on search criteria | jayarkay | Shell Programming and Scripting | 3 | 01-19-2010 01:36 AM |
| Append specific lines to a previous line based on sequential search criteria | jesse | Shell Programming and Scripting | 3 | 08-21-2009 02:01 AM |
| {How} Script to search a log file for a given criteria | indiakingz | Shell Programming and Scripting | 9 | 08-05-2008 03:42 PM |
| Select records based on search criteria on first column | shashi_kiran_v | UNIX for Dummies Questions & Answers | 2 | 12-02-2005 12:49 PM |