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
RunApp::Apache(3pm)					User Contributed Perl Documentation				       RunApp::Apache(3pm)

NAME
RunApp::Apache - Apache control for RunApp SYNOPSIS
use RunApp::Apache; $apache = RunApp::Apache->new (root => "/tmp/apache_run", report => 1, apxs => '/usr/local/sbin/apxs', # httpd => '/usr/local/sbin/httpd', required_modules => ["log_config", "alias", "perl", "mime"], config_block => q{ [% IF AP_VERSION == 2 %] eval { use Apache2 }; eval { use Apache::compat }; [% END %] <Location /myapp> AllowOverride None SetHandler perl-script PerlSetVar approot [% cwd %] PerlHandler MyApp Options +ExecCGI </Location> }); DESCRIPTION
This is the class for defining a apache web server to be used in RunApp. CONSTRUCTOR
new (%arg) Required arg: root The root for the apache instance. apxs httpd If "apxs" is specified, "httpd" will be derived from it. required_modules A arrayref to the apache modules required. config_block The config block that will be the extra block in the template used by RunApp::Template::Apache. CTL The class for handling apachectl. The default is RunApp::Control::AppControl. You can also use RunApp::Control::ApacheCtl. CONF The class for handling apache config. The default is RunApp::Template::Apache. It is used in the "build" phase of RunApp SEE ALSO
RunApp, RunApp::Control::Apache, RunApp::Template::Apache, App::Control AUTHORS
Chia-liang Kao <clkao@clkao.org> Refactored from works by Leon Brocard <acme@astray.com> and Tom Insam <tinsam@fotango.com>. COPYRIGHT
Copyright (C) 2002-5, Fotango Ltd. This module is free software; you can redistribute it or modify it under the same terms as Perl itself. perl v5.8.8 2008-01-09 RunApp::Apache(3pm)
All times are GMT -4. The time now is 09:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy