Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Removing files with containg certain string of text

Posted on 2006-04-04
1
Medium Priority
?
252 Views
Last Modified: 2013-12-27
Hi All,

Currently I have a mail queue being building up and we need to delete all messages being sent to a certain domain name.  What is the best command to recurrsively go through each file and whenever it finds that specific domain name it either delets or move it to a tmp folder?

Many Thanks!
0
Comment
Question by:n-generation
1 Comment
 
LVL 38

Accepted Solution

by:
yuzh earned 500 total points
ID: 16377385
you can do someting like:

cd /var/spool/mqueue
for i in `grep -l "somewhere.com" *`  ; do
    mv $i /path-to/mytmpdir
done

or:
# delete them !
cd /var/spool/mqueue
rm `grep -l "somewhere.com" *`  
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Suggested Courses
Course of the Month15 days, 17 hours left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question