Sponsored Content
Top Forums Shell Programming and Scripting To find a word in a file and delete the file Post 302317816 by aigles on Wednesday 20th of May 2009 04:22:06 AM
Old 05-20-2009
Try:
Code:
find . -type f -exec grep -l "word" {} \; | xargs rm -rf

Jean-Pierre.

Last edited by vidyadhar85; 05-20-2009 at 05:30 AM.. Reason: "e" was missing from -exec
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

find a word in a file, and change a word beneath it ??

Hi all, I have a file with lines written somewhat like this. aaaa ccc aa linux browse = no xssxw cdcedc dcsdcd csdw police dwed dwd browse = no cdecec (2 Replies)
Discussion started by: vikas027
2 Replies

2. UNIX for Dummies Questions & Answers

Find a word and delete the line

Hi I have a text file like this name today.txt the request has been accepted the scan is successful at following time there are no invalid packages 5169378 : map : Permission Denied the request has been accepted Now what i want do is I want to search the today.txt file and if i... (1 Reply)
Discussion started by: gsusarla
1 Replies

3. Shell Programming and Scripting

How to delete a word from a file?

Hi All, I want to delete a word from file. How to do that. I have file that contains the following Information. EntityName:alba00r1.mis.amat.com OverallStatus:Minor IfName:Gi1/0 EntityName:alba00r1.mis.amat.com ] OverallStatus:Normal IfName:Se0/0/0... (4 Replies)
Discussion started by: ntgobinath
4 Replies

4. Shell Programming and Scripting

Delete repeated word in text file

Hi expert, I am using C shell. And i trying to delete repeated word. Example file.txt: BLUE YELLOW RED VIOLET RED RED BLUE WHITE YELLOW BLACK and i wan store the output into a new file: BLUE (6 Replies)
Discussion started by: vincyoxy
6 Replies

5. Shell Programming and Scripting

Delete everything after/before a word in a file

I'm looking for a command that will read a file listing information and delete everything after a certain word is found. I also may need to search the file and delete everything before a certain word. The file would contains fields of information like below repeating for the entire file; Name... (5 Replies)
Discussion started by: daveisme
5 Replies

6. Shell Programming and Scripting

How to delete the last word in a file?

Hi All, I have a file with the data as below. In this i want to delete the last word. Could you pls help me. $INSTALL_HOME/lib/fm_voucher_pol.so $INSTALL_HOME/source/sys/fm_apn_pol/fm_apn_pol_device_set_state.c In the above two lines i want to delete fm_voucher_pol.so and... (5 Replies)
Discussion started by: girish.raos
5 Replies

7. UNIX for Dummies Questions & Answers

Script to delete a word based on position in a file

Hi, I am new to unix. I want to delete 2 words placed at position say for example at 23rd and 45th position in a line. I used sed but couldnt achieve this. Example: the file contains 2 lines 12345 98765 "12345" 876 12345 98765 "64578" 876 I want to delete " placed at position 13 and 19... (4 Replies)
Discussion started by: nbks2u
4 Replies

8. UNIX for Dummies Questions & Answers

Shell script find word from one file and insert in another file

Hi, I am new to shell scripting. I need a bash shell scripts which search and grep a parameter value from input.txt file and insert it in between two semicolon of second line of output.txt file. For example The shell script search an IP address as parameter value from input.txt ... (2 Replies)
Discussion started by: sunilkumarsinha
2 Replies

9. Shell Programming and Scripting

How to find a particular word from a file

Hello Experts, I have to count the word like "RESULT_CODE: : -6" from the multiple files names like req.result_2_vqx-71144750.log for a particular date. Lets suppose the date is 10 OCT 2011. How I can do it with a single command in Solaris environment. Reagrds Oracle User (8 Replies)
Discussion started by: Oracle_User
8 Replies

10. Shell Programming and Scripting

Delete word from the file

My file has contents like below. It is named as output_file.txt /usr/sas/sas_config/Lev1/SASApp/StoredProcessServer/Logs/SASApp_STPServer_2015-08-27_tmptcmsaslva2_19142.log /usr/sas/sas_config/Lev1/SASApp/StoredProcessServer/Logs/SASApp_STPServer_2015-08-27_tmptcmsaslva2_19142.log... (12 Replies)
Discussion started by: Ram Kumar_BE
12 Replies
ZGREP(1)						      General Commands Manual							  ZGREP(1)

NAME
zgrep - search possibly compressed files for a regular expression SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename... DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code: (-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If the GREP environment variable is set, zgrep uses it as the grep program to be invoked. EXIT CODE
2 - An option that is not supported was specified. AUTHOR
Charles Levert (charles@comm.polymtl.ca) SEE ALSO
grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1) ZGREP(1)
All times are GMT -4. The time now is 10:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy