The grep tag has no wiki summary.
1
vote
1answer
24 views
solaris + egrep command syntax not work
my target is to match snmpmanager string from /etc/hosts file in Solaris machine
I don’t get any match output from the following command (but snmpmanager already defined in host file) why??
egrep ...
0
votes
1answer
19 views
Exclude long lines from grep results
How do I exclude very long lines from grep results?
I often grep through lots of .js files (-r) and some of them are compiled, so they consist of a single line usually a couple thousand characters ...
0
votes
1answer
51 views
Get the most common appearing lines from file in Linux
I have a text file that has various words per line.
How can I find the 12 most frequent appearing lines in the file and display them?
I am not very good with scripting commands.
If I could get the ...
3
votes
4answers
75 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 ...
0
votes
1answer
28 views
How to find uptime of a linux process
How do I find the uptime of a given linux process.
ps aux | grep gedit | grep -v grep
gives me a whole lot of information which includes the time at which the process was started.
I am specifically ...
0
votes
3answers
91 views
Count all files without using find
How can I count all files without using find and only grep? I tried using ls recursively but how can I pipe that to grep and count files?
0
votes
1answer
61 views
Combine tail -f with grep?
Hi I wanna keep looking at a log file, but I also don't wanna see irrelevant stuff, I'm only interested in anything with "foobar" in it.
So if I was tailing the file I would do
tail file | grep ...
0
votes
0answers
18 views
pdfgrep error under cygwin
I am trying to grep over some pdf using pdfgrep which I download from here:
http://fd0.x0.to/cygwin/release/pdfgrep/
I then unzip it and put files into the cygwin corresponding folders.
Initially I ...
2
votes
1answer
43 views
Checking if any data exists on a presumably empty storage device
So, say you've completed a full pass of:
dd if=/dev/zero of=/dev/sdX bs=1M
Then, you'd like to make sure the destination has been really zeroed out (ignoring the confirmation messages from dd ...
3
votes
1answer
28 views
Get additional data around match from grep
I'm wondering how to improve my grep use when being confronted with files with very long lines. Imagine something like "packed" JavaScript files that only have 1 line. Sometimes files like that spit ...
0
votes
1answer
55 views
cygwin grep in files takes forever
I tried used cygwin to emulate some cool linux search feature and when I do grep in files (12 text files - not big) it takes forever. I used
grep -rne word
I could find this word faster ...
0
votes
1answer
27 views
How do I grep for foo && !bar?
I want to output all the lines in my source code which contain the string foo but don't contain the string bar. I tried this:
find . -name "*.[hc]pp" | xargs grep -n foo | grep -x bar
However ...
0
votes
2answers
117 views
Can any of the diff/grep utilities do a “file grep”? [closed]
Possible Duplicate:
Duplicate file finder
... to continue on the title, basically what I want is for me to give him the file, and the program goes through the whole project directory and ...
0
votes
1answer
17 views
ack doesn't recurse when specifying a file pattern
ack "#define"
will recurse into subdirs and find files that contain #define. But I wanted to limit the search to *.h files, so I tried
ack "#define" *.h
and it doesn't recurse anymore. The only ...
4
votes
2answers
67 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
2answers
59 views
Finding multiline CDATA text in a bunch of XML files (possibly using grep)
I have several thousand (well formed) XML files of the following template :
<?xml version="1.0" ?>
<queries>
<statement name="foobar">
<body><![CDATA[
Several ...
4
votes
1answer
44 views
Grep for many arguments [closed]
Possible Duplicate:
Grep command, to remove lines containing a specified word
How do I grep for more than one words in one grep command. For example:
cat file.txt | grep -v 'word1' | grep ...
3
votes
2answers
61 views
Aren't egrep, fgrep supposed to be aliases to grep?
Since egrep is essentially grep -E I would expect it to be an alias that calls grep with that option. However on my system
file `which egrep`
shows it is an executable. Also egrep as an alias only ...
1
vote
3answers
123 views
Can't pipe or redirect cygwin grep output
How do I get grep to work properly in a regular cmd.exe?
> grep -o 'ProductVersion\".*\".*\"' foo.txt | grep -o '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+'
foo.txt:ProductVersion" Value="59.59.140.59"
grep: ...
0
votes
1answer
35 views
How to find the last match of a string in a bunch of files
I have a bunch of files, I'd like to find the last match of a string in each of them.
grep text *.file gives me all the matches not the last ones.
ls *.file | xargs grep text | tail -n 1 gives me ...
0
votes
2answers
55 views
Print the common of the two files
i want it to print the common of the 2 file
one file contain the ls -l option and the other one have the ls
ls only have the file name
ls -l have everything including the permission and other ...
0
votes
2answers
74 views
How to use Grep in Unix command line?
I want grep all lines containing words that start with "H" and end with "d". How would i do that? I found that grep ^H will give me the H for everyline.
0
votes
1answer
30 views
Can I use gnu grep to search for unmatched parens (and similar)?
I write text files in the MoinMoin Wiki markup language in a text editor (emacs). When I mis-place one of the special tags my whole page gets mangled with the wrong formatting -- or worse. I always ...
1
vote
1answer
106 views
Using tee to pipe ls and grep output into tail command without a script
I have an issue running through log files.
I'm looking to use ls to create a list of files in the log directory and grep to run through for the specific instances/times the file ran. I only want to ...
0
votes
0answers
30 views
Linux “rpl” command doesn't replace text [closed]
Possible Duplicate:
Linux “rpl” command doesn't replace text
I'm using rpl program in linux to replace date( with pdate( in some files.
But it says A Total of 0 matches ...
-1
votes
1answer
51 views
Linux “rpl” command doesn't replace text
I'm using rpl program in linux to replace date( with pdate( in some files.
But it says A Total of 0 matches replaced in 1 file searched.
while grep output for date( is:
...
1
vote
1answer
49 views
Grep command, to remove lines containing a specified word
I want to use grep in the following way:
grep -v "END","EXPDTA" 1bmz_model1.pdb > 1bmz_model.pdb
I want the grep command to remove the lines which contain the words "END" and "EXPDTA", but all i ...
1
vote
1answer
89 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 ...
2
votes
8answers
62 views
How do I remove similar instances of lines using Unix commands?
I have a file that contains lines that look like the following:
14|geauxtigers|90
14|geauxtigers|null
I want to remove all instances in the file with the null as the last term. Is there a way to do ...
0
votes
1answer
84 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
185 views
Remove all except one file and directory at path
I need to remove all the files in a directory except for one file and one folder. Up to the grep I can output the correct list of items I want to remove but when i add xags, nothing is deleted.
this ...
0
votes
1answer
88 views
Error “grep exited abnormally with code 2” on Xemacs 21.4.22 on Windows 7
I am trying to run grep (cygwin) within Xemacs 21.4.22 on windows 7 enterprise laptop.
cd c:\
grep -n -r --include=*.java "foo" NUL:
grep: NUL:: No such file or directory
grep exited abnormally with ...
2
votes
2answers
48 views
pgrep faster than it takes to start process, use sleep?
I'm having some issues with my CSH script and the command:
set XVFBCHK2 = `pgre -f 'Xvfb' | wc -l`
It seems to return inconsistent values. When it should return 1 it returns 0. I'm pretty sure ...
1
vote
1answer
66 views
How can I display all the lines that end with a certain character using grep?
I want to write a command to display all the lines in a given file that end with a ";" or a "." character.
Why does this not work?
grep ".';' | .'\.'" filename
2
votes
1answer
70 views
What does <html> do in a grep command?
I was wondering what does the <> do in a grep command
grep a b c , try to find a in file b and c
grep <html> foo?
What does the <> do? Find the HTML tags?
0
votes
0answers
24 views
continued… grep -c gives inconsistent outputs [closed]
Possible Duplicate:
grep -c gives inconsistent outputs
I am trying to determine the number of processes that are running via the following command line:
ps aux | grep -c 'Xvfb :1'
When ...
1
vote
3answers
49 views
grep -c gives inconsistent outputs
I am trying to determine the number of processes that are running via the following command line:
ps aux | grep -c 'Xvfb :1'
When the process "fiji :1" is not running I sometimes get a value of 0 ...
0
votes
2answers
45 views
csh script to return number of process running
I want to set the number of a particular process that are running to a variable. The first line of the csh script below is the problem as it sets the variable "number" as ps aux | grep -c fiji ...
1
vote
2answers
36 views
Excluding paths in grep
I can't seem to find any documentation dealing with this: is there any way to stop grep from printing the path to the file of a matched line when searching over multiple files?
4
votes
2answers
66 views
Counting total number of matches with grep instead of just how many lines match
Does grep offer a way to count the total number of matches it makes? The -c option only returns the number of lines that matched the regex, but in this case I have multiple matches per line.
0
votes
2answers
32 views
Give parameters to grep command
I want to find some words from a file. I use grep command on linux.
grep "word1" original.file
But there are lots of words to find and they are in "words.file" If it is possible I want to give ...
2
votes
2answers
111 views
Why grep -i is so slow? How to do it faster for ASCII?
$ time lzop -d < tvtropes-index.lzo | egrep -B 5 '[Dd][eE][sS][cC][eE][nN][dD] ?[Ff][rR][oO][mM]'
real 0m0.438s
$ time lzop -d < tvtropes-index.lzo | egrep -B 5 'descend ?from' -i
real ...
1
vote
1answer
173 views
Strange grepped process list
When I run ps fax|grep grep it shows one process like:
2618 pts/0 R+ 0:00 \_ grep --color=auto grep
That would be OK, but when I run ps fax|grep -v dummy_text grep process ...
1
vote
1answer
76 views
How to print only an IP address list of traceroute?
How do I print only an IP address list of a traceroute run?
I don't want the web addresses like something-online.net and their round trip times.
How do I get a "simple" traceroute from the ...
2
votes
2answers
71 views
How to recursively find a .doc file that contains a specific word?
I'm using bash under Ubuntu.
Currently this works well for the current directory:
catdoc *.doc | grep "specificword"
But I have lots of subdirectories with .doc files.
How can I search for, ...
0
votes
2answers
71 views
Grep log for certain word only if followed by another word
I have a log file with entries like the following:
Input
php notice bob
php notice winner
php notice blah winner
php notice asfsdf test
php erro)r bob ...
0
votes
2answers
119 views
problem getting this simple regex to match in grep
I have answered my own question in its prior revision, no need to refer to it, but it leads to another strongly related matching problem, so i've revised this question to matching something very ...
0
votes
2answers
61 views
How do you search for specific text in specific file types? [closed]
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
76 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 ...
3
votes
3answers
86 views
How can I grep in source files for some text?
At the moment I'm using two commands, I'm sure there must be a better way...
wim@wim-acer:~/ffmpeg$ find . -name "*.h" -print0 | xargs -0 grep -i invalid\ preset
wim@wim-acer:~/ffmpeg$ find . -name ...