Sponsored Content
Top Forums Shell Programming and Scripting awk search & delete located criteria Post 302403417 by jaysunn on Friday 12th of March 2010 11:50:58 AM
Old 03-12-2010
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
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Advanced Search & Delete Text File

I have a file in which email messages are stored in. Every email is separated by by a ^Z character (Control-Z). I need to extract all emails after the 65,00th one to another file and delete them from the original file. Any suggests on accomplishing this? (2 Replies)
Discussion started by: maxcell
2 Replies

2. Shell Programming and Scripting

Delete new lines based on search criteria

Hi all! A bit of background: I am trying to create a script that formats SQL statements. I have gotten so far as to add new lines based on certain match criteria like commas, keywords etc. In the process, I end up adding newlines where I don't want. For example: substr(colName, 1, 10)... (3 Replies)
Discussion started by: jayarkay
3 Replies

3. Shell Programming and Scripting

awk + gsub to search multiple input values & replace with located string + extra text

Hi all. I have the following command that is successfully searching for any one of the strings on all lines of a file and replacing it with the instructed value. cat inputFile | awk '{gsub(/aaa|bbb|ccc|ddd/,"1234")}1' > outputFile This does in fact replace any occurrence of aaa, bbb,... (2 Replies)
Discussion started by: dazhoop
2 Replies

4. UNIX for Dummies Questions & Answers

delete rows with a criteria

Hi, I would like to know how can I delete rows of a text file if from the 3rd column onwards there is only zeros? Thanks in advance (7 Replies)
Discussion started by: fadista
7 Replies

5. Red Hat

Need Script to ZIP/SAVE & then DELETE Log file & DELETE ZIPS older than 12 months

ENVIROMENT Linux: Fedora Core release 1 (Yarrow) iPlanet: iPlanet-WebServer-Enterprise/6.0SP1 Log Path: /usr/iplanet/servers/https-company/logs I have iPlanet log rotation enabled rotating files on a daily basis. The rotated logs are NOT compressed & are taking up too much space. I... (7 Replies)
Discussion started by: zachs
7 Replies

6. Shell Programming and Scripting

Need To Delete Lines Based On Search Criteria

Hi All, I have following input file. I wish to retain those lines which match multiple search criteria. The search criteria is stored in a variable seperated from each other by comma(,). SEARCH_CRITERIA = "REJECT, DUPLICATE" Input File: ERROR,MYFILE_20130214_11387,9,37.75... (3 Replies)
Discussion started by: angshuman
3 Replies

7. Shell Programming and Scripting

How can I search with start and end criteria?

Hello I'm using cygwin and wouldlike extract information from an xml file according specific values, but don't know how. Let's say in a file content looks like this: <tab> SURNAME=Mustermann NAME=Max CUSTOMER SINCE= 18.01.2000 ADDRESS=Birmingham ... (2 Replies)
Discussion started by: witchblade
2 Replies

8. Shell Programming and Scripting

Delete duplicate row based on criteria

Hi, I have an input file as shown below: 20140102;13:30;FR-AUD-LIBOR-1W;2.495 20140103;13:30;FR-AUD-LIBOR-1W;2.475 20140106;13:30;FR-AUD-LIBOR-1W;2.495 20140107;13:30;FR-AUD-LIBOR-1W;2.475 20140108;13:30;FR-AUD-LIBOR-1W;2.475 20140109;13:30;FR-AUD-LIBOR-1W;2.475... (2 Replies)
Discussion started by: shash
2 Replies

9. Shell Programming and Scripting

SFTP Shell Script Get & Delete && Upload & Delete

Hi All, Do you have any sample script, - auto get file from SFTP remote server and delete file in remove server after downloaded. - only download specify filename - auto upload file from local to SFTP remote server and delete local folder file after uploaded - only upload specify filename ... (3 Replies)
Discussion started by: weesiong
3 Replies

10. UNIX for Beginners Questions & Answers

How to search & delete inclusively between two lines?

Hi all, I was wondering if anyone would know how to search & delete inclusively between two lines, please: Important: There are multiple }; lines. I'm curious how to delete the correct one only. Line numbers may vary each time this script is run. For example, I'd like to delete only the... (6 Replies)
Discussion started by: chatguy
6 Replies
delete(n)							    [incr Tcl]								 delete(n)

__________________________________________________________________________________________________________________________________________________

NAME
delete - delete things in the interpreter SYNOPSIS
itcl::delete option ?arg arg ...? _________________________________________________________________ DESCRIPTION
The delete command is used to delete things in the interpreter. It is implemented as an ensemble, so extensions can add their own options and extend the behavior of this command. By default, the delete command handles the destruction of namespaces. The option argument determines what action is carried out by the command. The legal options (which may be abbreviated) are: delete class name ?name...? Deletes one or more [incr Tcl] classes called name. This deletes all objects in the class, and all derived classes as well. If an error is encountered while destructing an object, it will prevent the destruction of the class and any remaining objects. To destroy the entire class without regard for errors, use the "delete namespace" command. delete object name ?name...? Deletes one or more [incr Tcl] objects called name. An object is deleted by invoking all destructors in its class hierarchy, in order from most- to least-specific. If all destructors are successful, data associated with the object is deleted and the name is removed as a command from the interpreter. If the access command for an object resides in another namespace, then its qualified name can be used: itcl::delete object foo::bar::x If an error is encountered while destructing an object, the delete command is aborted and the object remains alive. To destroy an object without regard for errors, use the "rename" command to destroy the object access command. delete namespace name ?name...? Deletes one or more namespaces called name. This deletes all commands and variables in the namespace, and deletes all child names- paces as well. When a namespace is deleted, it is automatically removed from the import lists of all other namespaces. KEYWORDS
namespace, proc, variable, ensemble itcl 3.0 delete(n)
All times are GMT -4. The time now is 07:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy