The grep tag has no wiki summary.
0
votes
4answers
45 views
solaris + grep syntax in solaris
my target is to match Exactly the string snmpmanager from hosts file on solaris & linux
the following command work on Linux (red-hat 5.1) but not for SunOS , please advice how to fit the syntax ...
4
votes
1answer
33 views
Can I run grep against a zOS dataset via Unix system services?
I have a search I'd like to run against a zOS dataset, and I know how to form the grep command. I have access to the machine via Unix system services, how to I address a dataset from that ...
2
votes
2answers
39 views
egrep not working in crontab
I have a simple bash script wich works fine when running in command line, but not in crontab:
#!/bin/bash
PATH=/usr/bin:/bin
for f in /data/home/cwolff/tmp/*access_log*.txt;
do
egrep "r:[A-Z]+ ...
0
votes
4answers
124 views
grep and tabs: no match
#cat sample
1 -1 2
2 2 2
2 1-1 3
I need to get all the lines that contains negative value, that is 1st line only. Values are tab-separated.
First I tried
# grep "\-1" sample
1 -1 2
2 ...
0
votes
0answers
35 views
grep syntax issue on Lion [migrated]
I have a text file and looking for the single line bird. Using OS X Lion and grep 2.5.1.
this works:
grep '^bird' file.txt
but this doesn't
grep '^bird$' file.txt
There is not a blank space ...
0
votes
1answer
58 views
How to find a file that contains the specified string in FreeBSD?
I'm searching for the way to find a file that contains specified string text.
It should be fast as possible but its not that important.
I was reading the manual, and I've build something like that: ...
1
vote
4answers
89 views
GREP show lines that contain this but not that
I would like to search for lines that contain "uploaded" but do not contain "09"
Is there a way to do this with grep?
(CentOS 5.6 if it matters).
3
votes
4answers
111 views
Grep progress bar using pv (pipe viewer)
I've got a huge directory on my computer and I need to search in every ruby file inside for a string.
I could have done it like this : grep -R "string" *.rb but it takes really long and I'd like to ...
-1
votes
2answers
53 views
tool to analyse/grep log files
Is there any web based GUIs to analyse or in realtime filter/grep log files from apache? log files that are access logs or error logs or postfix logs etc.
Edit: I don't mean traffic analysis. Much ...
0
votes
1answer
47 views
Ubuntu command to constantly monitor a service?
I was curious if anyone new a command like tail or top to constantly
monitor a service as it runs. I'm trying to watch sendmail currently
to see who is connecting to it, but would like to have it a ...
0
votes
1answer
23 views
Compare/Calculate like files
I have program generating reports on a regular basis.
These reports are follow a simple and consistent format (specifically, these are "OProfile profiling reports).
Each line's format is:
...
0
votes
3answers
48 views
grep out unique senders from a huge list of emails
I just found a huge list of emails under my user account in Centos /home/user/mail/new
I opened some of them and noticed they were sent from a particular cron job. From address is root@hostname.com. ...
0
votes
2answers
50 views
How to update my grep utility on CentOS 5.6?
I'm using a CentOS 5.6 system. Since there is a bug in my version of grep. I want to upgrade to a new version. I tried to use yum to update(upgrade) it, but failed.
[root@localhost ~]# cat ...
1
vote
1answer
142 views
How to grep httpd error_log within a time range?
How can I grep only lines from a huge (120GB) httpd error_log based on a time range, say:
from 2011-11-15 11:30 pm
to 2011-11-16 01:30 am
Thanks!
4
votes
4answers
74 views
Possible to use grep simply for finding files in a directory structure?
I like using grep but sometimes I just want to search for the names of files in a directory tree, but don't want grep to open the files and search inside them. Can grep do this?
3
votes
3answers
107 views
How do I grep through binary files that look like text?
I have binary files that should be text (they're exported logs), but I can't open it with less (it looks ugly - it looks like a binary file). I found that I could open it with vi and I can cat it ...
1
vote
5answers
90 views
Extracting lines from a file based on prefix
I need to extract all lines from file2 that begin with an id # prefix contained in file1.
File 1 is single column like:
324
399
408
135236
321590
File 2 is multi-column like:
1 [tab] 108 [tab] ...
6
votes
3answers
208 views
OS/2 grep had a great feature where it would show you n lines BEFORE the search item was found. Is there an equivalent in unix anywhere?
Solaris would be preferable, but I'll take linux or something I can compile. Does such a beast exist?
1
vote
3answers
118 views
How do I search by multiple keywords when using awk or grep?
I have a collection of files. I want to search through them all with grep to find all and only those which contain anywhere within them both the strings keyword1 and keyword2.
I would also like to ...
0
votes
2answers
38 views
Display specific word in file. To be used as varible, grep for email in log
I'm looking to display just the email address in the /var/log/secure file. The email goes into a variable, so just grepping for lines won't work.
I know how to string together sed commands, but is ...
3
votes
2answers
109 views
egrep matching group not printing?
I'm trying to create a bash script that will grep lines from a file using egrep. I've created the regex that should group the information I want, the issue is trying to get the output. I've been ...
17
votes
6answers
752 views
Can awk be used instead?
I would like to get the number from rating as output from this
# nc localhost 9571
language:
language:en_ZA.UTF-8
language:en_ZW.UTF-8
session-with-name:Ubuntu Classic (No effects):gnome-session ...
2
votes
3answers
219 views
grep - recognize carriage return as new line
I want to search a webserver running unix for php-files containing a specific string. Usually I use these commands to accomplish this:
find . -name "*.php" -print0 | xargs -0 grep -H -i "the string ...
-2
votes
1answer
38 views
matching any part of a expression using grep
How Can I use grep so as to return me all matches for not only entire expression but also any part of the expression.
example:
grep "foobar" foo
where foo contains text foo
should give me a match
...
4
votes
3answers
158 views
grep or sed to find a integer value above a given amount?
This is in reference to another question: How do I use robocopy to list all files over a certain size recursively?
I would like to parse output of a command (or cat a log file) and find a string ...
2
votes
1answer
59 views
compare first or third position
The mysql general log file looks like this...
110822 14:41:14 103700 Query SHOW FULL TABLES FROM `engine` LIKE 'PROBABLYNOT'
103700 Query SHOW FULL TABLES FROM `engine` LIKE ...
2
votes
5answers
84 views
How to remove a certain symbol for a bash script
I have a bash script where I get the disk usage, for example 60%. How can I remove the % symbol? Using grep or awk?
1
vote
3answers
73 views
Saving the out of tail
The following does not work...
tail -f /var/log/mysql/general.log | grep Connect > /home/myfile.txt
If I remove the "-f" switch then I am able to save the output to a text file, but it does not ...
0
votes
2answers
160 views
tee and grep at the same time (shell)?
I'm trying to run a server that writes to $log (a txt file) and then find all the text in the logfile that starts with [1] and put it in another file. Here's my attempt. tee -a $log works along with ...
2
votes
2answers
60 views
Locate a string in a folder and the file it came from?
I am trying to find some keywords in my /var/log directory, so using
cd /var/log
cat * | grep keyword
I find the string is in that directory and see the lines it exists on, but don't know which ...
3
votes
8answers
445 views
grep to display folders which contain files which contain a string
I need to run a grep on my server to search for files which extend a CodeIgniter 1 file, as we are upgrading to CI2. In one folder contains several hundred site-specific folders like such:
...
0
votes
3answers
162 views
AWK - Is it possible to search for pattern, then sort results based on a wildcard?
I am storing a number of individually serialized PHP arrays to a file. Each line of the file contains one serialized array. For example:
a:2:{s:4:"name";s:8:"John Doe";s:3:"age";s:2:"20";}
...
5
votes
2answers
274 views
cat * | grep something… what file is the result in?
If one was to run the following command
cat * | grep DATABASE
the shell would spit out all the lines in * files that contained the word DATABASE in them. Is there any way to also spit out what file ...
1
vote
2answers
38 views
find files and search for within tail
The following is working as expected.
find /opt/ -name "somefile.out" -exec grep 'Connection refused' {} \; | more
But if I want to search only in the tail of the found files, I can not add tail or ...
2
votes
4answers
139 views
remove 2 lines from output, grep match regular expression plus next 1
i have a log file from postgresql that has log entries of the format;
LOG: execute <unnamed>: /match this here/
DETAIL: parameters: /also want to filter this line/
I thought it might be ...
1
vote
1answer
95 views
Using Find, Grep, Awk, or Sed To Rename Server After Cloning
My client tells me they have cloned a VM in VMWare of an Ubuntu Linux server. Now it's my job to get into all the files and find out what still has the old server name of "bishop" and change it to ...
1
vote
1answer
113 views
redirecting “tail --follow=name | grep” to a file
Here is my scenario:
I have a log file that is being wrote too by an application. The log file is named "alarms.log". I want to tail the file for a certain string and redirect that to a file called ...
14
votes
4answers
779 views
In tail -f, how do I filter out stuff that has certain keywords?
I want to tail -f my logs. However, I want to filter out everything that has the words:
"ELB", "Pingdom", "Health"
0
votes
1answer
55 views
Following a file mixed with grep to exclude lines
Basically I want to combine the function whereby you can Less a file and then Shift+F to follow the file, as you would do with Apache's access.log.
However I would like the output to ignore/hide ...
0
votes
2answers
96 views
grep -r pattern ./ without recursion?
I want to run the grep -r pattern ./ but WITHOUT recursively going through the sub directories. When I removed the -r flag, I didn't get any output in my terminal. What flag am I supposed to use to ...
2
votes
1answer
60 views
Logcheck: wildcards which include non-latin characters
On my mail server, I have a custom logcheck rule as follows, which is intended to filter messages from deliver:
^\w{3} [ :0-9]{11} [._[:alnum:]-]+ deliver\.*\): msgid=.*: saved mail to.*$
...
8
votes
5answers
177 views
Grepping through .gz log files
Does there exist a magical shell piping which would allow easily to grep through bunch of .gz log files without needing to extract them somewhere?
.gz files are Apache logs, result of log rotation. ...
2
votes
2answers
94 views
How can I handle spaces in file names when using xargs on find results?
One of my common practices is to perform greps on all files of a certain type, e.g., find all the HTML files that have the word "rumpus" in them. To do it, I use
find /path/to -name "*.html" | xargs ...
1
vote
0answers
76 views
How to define mail from and host settings in Websphere 6.1 for Java application
Working with some older WAS 6.1 hosts (fix pack 25), and have a java app that sends mail from one host with a mail from field:
nobody@nosuchhost.nosuchdomain.com ...
1
vote
2answers
89 views
Need help with grep urgently to comply with subpoena request
I am not a system administrator but I run a little website and today I have received a subpoena request from police, in order to comply I need to extract IP addresses from our server logs for needed ...
0
votes
2answers
126 views
Is there a flag I can pass to either `df` or `mount` to make them display results for only locally-mounted filesystems?
I'm getting mighty tired of having to manually egrep out NFS- and SMB-mounted filesystems whenever I am checking on the condition of locally-mounted filesystems. So, my question is thus: is there some ...
1
vote
2answers
73 views
ignore lines grep
I have a very annoying message being output from a process I'm running. I'd rather not remove the line, but simply remove it with grep
The messages to ignore all contain the word "requests". I could ...
1
vote
4answers
246 views
How I can tell grep to search in file that I have permission?
When I call
cd /
grep -r "some_str" .
then I see lots of files printed on the screen and in the end of the line I see ": Permission denied". How I can tell the bash to search only in file that I ...
1
vote
3answers
102 views
alias to replace a text in file
here is a practical situation.I facing some of my files where there is a common string in these files.I usually will open vi and do some thing like
:%s/text/replacement/g
and I have to do it in ...
6
votes
6answers
2k views
how to find out mac addresses of all machines on network
Is there some easy way to find out mac address of all machines on my network rather than doing an SSH into each and ifconfig | grep HWaddr if there are 300 machines on network I really need some easy ...