0
votes
2answers
36 views

How to List Files greater than particular timestamp?

I have a directory in linux which has a list of log files where log files get auto generated if some job runs. Each log file gets appended with the timestamp like "JobName_TimeStamp" UPDATED: ...
1
vote
2answers
45 views

Find all php files which first or second line has more than N characters

I would like to find all php files on my server which first line or second line has more than N characters. I would like to print both the file name and the line content that was found. How would I ...
1
vote
1answer
32 views

Find word that has more than 50 characters in all php files

I am trying to use find in combination with grep to find all the php files in my web server which have a word (any sequence of characters except whitespace) with more than 50 characters. I have this ...
1
vote
2answers
44 views

How to find files which do not contain their own filename

When using templates to generating files, it's important to include the template's name inside the template. When reading a generated file, it helps you find the template used to generate it. I want ...
0
votes
1answer
22 views

How to find files that contain a string in its content OR the path?

Find and grep does not work afaik because I need to create a list of files that satisfy EITHER requirement, not both. I assume this requires more than a one-liner. Any suggestions?
0
votes
2answers
43 views

grep out condition and add the values of the grep value

I have a scenario that a csv file has the values of : abcd FAILURE 7 abcd SUCCESS 12 efgh SUCCESS 3 efgh FAILURE 5 mnop SUCCESS 6 mnop SUCCESS 4 abcd FAILURE 5 efgh SUCCESS 2 mnop SUCCESS 1 ...
0
votes
0answers
18 views

Finding files that are mostly NUL

I've got a hard drive copy that went bad where many files are of correct size but are completely filled with NUL (0x00) bytes. However, a couple of the files seem to have a couple KB of actual data. ...
1
vote
4answers
86 views

String Search: find and grep and?

Task: 1) find a string 'decor' inside files in a directory 2) get # of occurrence for decor for each file that has it The first part of the problem is partially solved with find . -type f | grep -i ...
1
vote
2answers
219 views

batch find/replace using sed or awk

In every file with filename matching pattern1 I want to search for lines which start with pattern2, and add some string in a new line above those matched lines. As a simple example suppose I'm ...
1
vote
2answers
66 views

How do I search for a string in a group of files when some of those files contain spaces?

I'm running Mac 10.7.5. In a terminal, I'll use this command for finding files with strings find src/main -name "*" | xargs grep -i 'mystring' However when the files contain spaces, I'll get ...
-1
votes
2answers
46 views

Unix - Searching for every file with a certain string in it

I am searching for every file within a root directory and want to search every subdirectory as well. I have tried grep -r "message" * but I am not sure that this searches every subdirectory, any ...
3
votes
2answers
1k views

Efficient way to search string within file find and grep

I am searching all files containing a specific string on a filer (on an old HP-UX workstation). I do not know where the files are located in the file system (there are many directories, with hudge ...
0
votes
2answers
183 views

Linux command to find all instances of a file pattern?

I'm looking for a way to scan a directory recursively and print out all instances of any file that ends ".qfx". Thus, for a given directory: somedir/ fizz.qfx buzz.qfx blah/ ...
3
votes
2answers
250 views

linux: is tree -i -f -L $depth supposed to be faster than find -maxdepth $depth?

I am querying specific directories to see if I find files with a specific pattern in them and I have been trying it with two different commands: Standard find command: find -L $unix_dir\*/ -maxdepth ...
3
votes
1answer
4k views

Ubuntu Linux: find files between specific times?

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: ...
0
votes
1answer
984 views

Using find with -exec gzip and grep

I have a bunch of zipped up log files and I want to search them all for a string. I tried this but it's not working: find ./ -name "*.log.zip" -exec gzip -dc {} | grep ERROR \; It's giving me: ...
0
votes
4answers
1k views

How to combine find and grep to recursively search for str or str2 in *.html and *.php files from /home/smith/sourcecode?

How can i combine find and grep to search for str1 or str2, recursively, in all *.html and *.php files starting from a directory named /home/smith/source? The output only needs to list files (with ...
1
vote
2answers
84 views

Finding folders only

My harddrive is in a mess, so I decided to do a cleanup. As a part of this, I want to merge all folders containing music into one. What I want to do is, look for any *.mp3's and *.aac's on my drive ...
6
votes
2answers
516 views

Why is the grep/-r/--include combination slower than the find/-exec/grep combination?

From my understanding, the two following commands roughly accomplish the same thing: Command 1: find -name "filename.xml" -exec grep someString {} \; Command 2: grep -r --include=filename.xml ...
3
votes
2answers
258 views

find any script which is running for more than say 30 minutes in Linux System

Please share command to find any script which is running for more than say 30 minutes. in Linux System
-1
votes
2answers
49 views

numbering some content of a file using grep or any other commands

I have a file like this: ==================================[RUN]=================================== result : Ok CPU time : 0.016001 s ...
2
votes
2answers
376 views

Grep, find line with minimum x words

Is there a way to find all lines with grep, that contains at least x words?
3
votes
5answers
1k views

Grep all files in a directory and print matches with filename

I have a list of log files that I create as part of a video encoding script that I wrote. I would like to search all of them and print out certain statistics from the encode - how fast they were ...
3
votes
2answers
374 views

How can I retain grep's match highlighting when piping find into grep?

If I run grep foo bar.txt, grep highlights each occurrence of "foo" in bar.txt. But sometimes I want to use find to determine which files grep searches. So I do something like this: find . -iname ...
0
votes
2answers
107 views

Generate a files list and truncate it in 2 list of X Mb of files each

I need to generate a list of all files in a certain dir, and truncate it in X lists containing each one a fixed amount of data of files. E.g. I have 95 Gb of data. generate the file list ...
0
votes
2answers
406 views

grep doesn't produce the correct output when run on find command

My task was to print the number of files in the current directory without using ls and wc commands. I had typed the following lines in the script: #!/bin/bash find . -maxdepth 1 -type f \( ! -iname ...
2
votes
2answers
459 views

Search all files containing text

With Busybox, how do you search for an expression within a bunch of files recursively through a bunch of directories, but only look through text files? We don't know what the file's suffix is going ...
2
votes
2answers
532 views

Why is find exec grep > file an Infinite Loop?

I was trying to collect all of the Message-ID: headers (lines) in a directory with 200K .eml (plain text) files. A bit naively, I said: find -type f -exec grep -Fi "message-id:" {} \; > ...
1
vote
2answers
293 views

List all files in a directory matching a string and copy output

I'm trying to create a series of playlists on my MP3 player, running Rockbox, by finding a file matching a string, using find /cygdrive/g/MUSIC -type f -name "Search Criteria" | ...
7
votes
4answers
5k views

Ubuntu grep, find etc: “Permission denied” and “No such file or directory” output

When I grep or find something I always get annoyed by the "Permission denied" and "No such file or directory" notice, smth like that: johndoe@johndoe-desktop:/$ grep -rnP 'YII_CORE_PATH' ./ | grep -v ...
4
votes
3answers
396 views

Search text in list of files

I'm trying to execute double search within files and return file names. I'm using find ./ -iname '*txt' | xargs grep "searchtext" -sl to find file names with 'searchtext' in them. Command is ...
1
vote
1answer
411 views

Linux find and grep for files not match pattern

I'm trying to search the entire file system for specific text. This command does that but it gets hung up in certain directories like '/proc': find / -print0|xargs -0 grep whatever What I'd like ...
0
votes
1answer
662 views

“find | grep | awk” fails miserabily

I'm scanning for all shell scripts on my server, and are doing this by the following command: find / -type f -exec file --mime-type {} \; | grep "text/x-shellscript" This is working fine, and here ...
1
vote
2answers
6k views

How do you search for specific text in specific file types? [duplicate]

Possible Duplicate: How can I grep in source files for some text? What's the command to search for specific text in specific file types, recursively, under the current directory?
1
vote
2answers
166 views

Can I simulate ack by using grep with the right combination of options?

I have ack-grep installed on my local machine, and find it indispensable for quickly 'acking' through a codebase when debugging. However, on my cheap shared hosting, there is no ack-grep. One of the ...
1
vote
3answers
196 views

How can I determine whether different commands using grep, find and xargs do the same thing?

Do these three commands do the same thing? A command that uses grep. grep "a" -r . A command that uses find. find . -exec grep "a" {} \; A command that uses a grep on a find through xargs. ...
1
vote
6answers
2k views

Finding files based on date, without using `find`

I know find can do what I am looking for, but I am wondering if there is an alternative way to find files on the filesystem either created before/after a certain point, or at a certain time. ...
0
votes
2answers
134 views

Case sensitive searching in linux

In linux, I want to search for a word in all files in a directory (also in subfolders), the search must be case sensitive. The search must give me all file names, directory names, and line numbers ...
1
vote
2answers
2k views

GREP and TAR all files/directories matching X

I would like to find and gzip/tarball contents of all the folders matching wordpress in my directory, but I am having trouble trying to get the command to work, I thought it was something like find ...
2
votes
1answer
709 views

tar - exclude certain files

I wish to tar all files in a directory and its subdirectories that do NOT end in .jpg, .bmp, .gif, or png. So, given the following folders and files: foo/file.txt foo/file.gif foo/bar/file ...
4
votes
2answers
1k views

Difference between grep -l and find in UNIX

Is there a difference between grep -l and find in UNIX?
0
votes
2answers
4k views

How to grep or find exactly what i am looking for?

How can i search a word called "Onderh"? Advanced search i would like to do such as: starting line with "Onderh" or line contain "Onderh". Note: Local Backup directory, contain every days a snapshot ...
0
votes
0answers
187 views

What's a good find / replace utility for Mac OS X? [duplicate]

Possible Duplicate: Mac OS X search and replace tool with regular expression support I'm looking for a utility to do some multi-line find / replace with a GUI interface, possibly with some ...
7
votes
4answers
7k views

How to list all source files (*.c, *.cpp, *.h)

I'd like to find source files (*.c, *.cpp, *.h) that contain in Linux/MinGW/Cygwin, and recursively in all sub directories. My basic idea is using find and grep. However, building a regular ...
8
votes
1answer
3k views

find / grep command without searching mounted shares

When I used the find command, I almost always need to search the local drives. But, I almost always have super large network shares mounted and these are included in the search. Is there an easy way ...
3
votes
2answers
4k views

Using find or grep to locate filenames with accented characters from a different encoding system (Windows to Linux)

I tried to tag late onto a question similar to mine on stackoverflow (Find Non-UTF8 Filenames on Linux File System) to elicit further replies, with no luck so far, so here goes again... I have the ...
4
votes
3answers
2k views

How do you search for strings in a file which in turn is in an archive?

I search through a number of files for a particular string by pipelining 'grep' and 'find' commands. Now, I have some 10 zip files each of which has archived a lot of text files. Is there any way I ...
4
votes
5answers
3k views

how do I find a phrase/word recursivly in a file tree in linux

how do I find a phrase/word recursively in a file tree in Linux? I tried find . -name ./* | grep my_phrase and I tried grep -r "register_long_arrays" *
1
vote
2answers
501 views

How do I run a command on each file within a directory that matches a pattern?

I'm trying to run a command on every file within a directory (recursively) that matches a pattern. I need the filename of each item that matches for the command however. This is how far I've got: ...
0
votes
1answer
295 views

How to search for files and directories using a single find command

I am using UnxUtils on Windows and it comes with the find tool. I am using it to search for files and directories. If I wish to search for a file name which contains the word 'Identity', I use the ...