I found an SO called using Find/Grep to search files between specific time of day
Based on that and a Unix SE called Grep command to find files containing text string and move them I ended up with:
find . -type f -mtime -20 | grep -v -e " \(0[012345]\|18\|19\|2[0123]\)" | xargs mv -t daytime/
But it's moving ALL the files.
I'm trying to find all files that are of a certain type and do not contain a certain string. I am trying to go about it by piping find to grep -v
example:
find -type f -name '*.java' | xargs grep -v "something something"
This does not seem to work. It seems to be just returning all the files that the find command found.
I try to find many files in many folders with specific content, and delete them.
find dir.*/* -exec grep -l "content" {} \; | xargs rm -f
And I get following message:
-bash: /bin/find: Argument list too long
Can you help me?
find . -name '.htaccess' -print | xargs grep -il 'sound' | xargs -p sh -c ">{}"
Trying to find some .htaccess files on a host that've been compromised, grep them to make sure they are bad .htaccess (not all on server have been ruined) and blank them out.
All is working, except the last part. Tried many variations of echo > etc.
I have a directory of lots of .PDF and .JPG files.
There should be a .JPG file for each .PDF with the same name.
I'm trying to use a command to find .PDF files that doesn't have a .JPG file.
My desired outcome is the following: to recursively search a directory looking for a given string in all found files. The following command is my usual port of call:
find ./ | xargs grep -ns 'foobar'
However, when foobar has quotes the command fails and gives me a > prompt in the shell.
Hi,
I have created a shell script for Server Log Automation Process. I have used
find xargs grep command to search the string.
for Example,
Code:
find -name | xargs grep "816995225" > test.txt
.
Here my problem is,
We have lot of records and we want to grep the string 4-5 times.
My server has been infected with malware.
Hi,
I'm testing nginx-cache-purge and notice that grep searches all file content, and since the cache key is in the second line I would like to limit grep searching.
This is the script I'm using:
github.com/perusio/nginx-cache-purge
The line I would like to change and limit grep search to the Second line is:
Code:
find $2 - maxdepth 1 - type d | xargs - P $max_ pa ralle l - n 1