Debian :: Grep Not To Show Ones Containing "term" / "string"
Jan 7, 2010
it should be simple, but i don`t get it: if i search for stuff, i may pipe it to grep to "filter" it:
Code:
ls /usr/bin | grep ice
but how would i say grep not to show the ones containing "term"/"string" example would be with locate
Code:
locate fluxbox | -> but not the ones in /home
View 4 Replies
ADVERTISEMENT
Nov 11, 2010
I want to pipe the output of a command into grep as the search TERM, rather than the text to be searched, like this for example
Code:
cat /var/log/auth.log | grep date "&b &d"
so that I only see the lines in auth.log for the current day...but obviously that line doesn't work.... is there a way to do this with grep, or even another command?
View 4 Replies
View Related
Jul 29, 2010
Today, i checking my error log of Apache. I have look many IP brute scan URLo, i collect, export that to ip.txt and i need grep IP with connection >=8I don't know command to solve that. Example ip.txtQuote:
101 210.13.73.30
161 58.210.77.98
164 115.168.71.87
[code]....
View 2 Replies
View Related
Aug 23, 2010
I am trying to monitor how long an ldap search takes and maybe notify or something that a search takes longer than say 10 seconds.
Code:
tail -n 1000 /var/log/ldap.log
for SRCH in $( cat monitorldap.log |grep 'SRCH'); do
echo search string is
echo $SRCH
[Code]....
ok, so to start off with it doesn't appear to get the whole line, just a piece "Aug". How can I get the whole line into a variable so I can then cut it up into the pieces I need?
View 4 Replies
View Related
Apr 28, 2011
Q: Is there any way to use grep and sed with a string variable rather than with a file?
The problem: Im running through a LARGE (about 10,000 lines) xhtml file and need to replace every instance of lines beginning <p>~
The following code works but takes a long time mainlly because an in/out operation needs to be carried out on each line. If I could read from a string rather than a file it would take a much shorter time!
Code:
#!/bin/bash
count=$((0))
>tpf
echo "waiting....."
[Code].....
View 4 Replies
View Related
Feb 9, 2010
I am using Sun 5.9.
I am putting the value "Feb 10" in variable 'c' here.
Code:
-bash-3.00$ c=`date | awk '{print $2 " " $3}'`
-bash-3.00$ echo $c
Feb 10
But when I am grep-ing value of 'c', I am getting this error.
Code:
-bash-3.00$ ls -lrth | grep $c
grep: can't open 10
This is because there is a space between "Feb" and "10".
View 5 Replies
View Related
Apr 29, 2010
How do I find a string in files in a directory. And these file names begin with letter a. I also want to get the number of occurrences of this string from the grep I run.
I tried this:
cat * | grep -c string but it searches all files. I just want to search files that begin with letter a
View 5 Replies
View Related
Jul 28, 2010
I am using grep to filter out directories I am not interested in like this:svn stat | grep -v data/charts | grep -v lib/model | grep -v web/picsIt seems a bit "hacky". Is there a better way to specify more than one string to ignore, so that I dont have to chain multiple grep commands?
View 3 Replies
View Related
Jan 19, 2010
I am searching for Class declaration on a site with hundreds of PHP files, how can I do this in the current folder and subfolders using GREP?
I tested cding to the folder and then something like
grep -r 'class MyClass' *.php
View 5 Replies
View Related
Jan 13, 2011
I have a mail.log file, of which I want to redirect only the search strings of the sender from=<example.sender@exampledomain.com> and the size size=4537 to a file.
In every case the sender string starts as from=<> and the size string starts as size=
What would be the grep command to redirect only the two search strings to a .txt file?
View 2 Replies
View Related
Oct 27, 2010
I want to write some code to search for a specific string in a text file, but without using grep command.
View 5 Replies
View Related
Sep 1, 2011
how to search for those files which contain word "AM_COLLECTION=22". I need to know all the files with this string. ( I know the grep command can do it but either
View 4 Replies
View Related
Apr 11, 2011
I want to match some filename in some text, but the filenames I have no control of, so "[" can "]" can appear in the filenames.so do I always have to use sed to addslashes to these variables before I have to grep them? and what other characters have I missed other than "[", "]", "."?
View 4 Replies
View Related
May 5, 2010
in the access logs i have this:
Code:
IP.IP.IP.IP - - [01/May/2010:11:21:10 -0400] "BIG STRING" 414 250
how can i grep and pull the IP based on the request string?
View 7 Replies
View Related
May 3, 2011
I am having trouble using grep command. I want to search for each line in first file in second file and if they are present, write to file called successfile else to failfile. Below is the code
what is happening is, when the first failure occurs (when a line in first file is not present in second file), the script is killed.
Can anyone please tell me what I am doing wrong? code...
View 4 Replies
View Related
Sep 3, 2010
I am trying to grep a particular string from the files of 2 different servers without copying and calculate the total count of its occurence on both files. File structure is same on both servers and for reference as follows:
Code:
27-Aug-2010 10:04:30,601|919122874903|phtunes_app|1282243292627|NotifySmsReception|DMGenerateLogInterceptor - ExternalTransactionID:SDP-DM-26713018, TransactionStatus:Requested
27-Aug-2010
[code]....
View 6 Replies
View Related
Jan 19, 2010
I need to search a text file for a string of numbers which are different lengths, and always are between number=" and " like:
number="1234567890"
number="22390"
I need to grab those numbers and pipe each one to a line in a file. I've already tried something with awk and that didn't seem to work.
View 10 Replies
View Related
May 17, 2010
I forgot a lot of my command line. I am doing cat file | grep "error" and i would like it to show everything to the right of G:/ including G:/ if possible. I figure its an awk command but i dont know what. I tried awk '{print $8+}' but + does not work like i hoped and guessed.
View 2 Replies
View Related
Oct 31, 2010
This has to also show the line count. I can get it to show the files but not the line count. What is the single command used to identify only the matching count of all lines within files under the /etc directory that contain the word „HOST? List only the files with matches and suppress any error messages.
View 4 Replies
View Related
May 7, 2011
How to grep a string like "ab?c12345678" where 3rd character is unknown, while other characters are known.
View 2 Replies
View Related
Mar 17, 2010
I want to find out into some directory, all the files which names are composed of : A specific word README, a litteral "." and any string
file name sample like: "README.string"
View 5 Replies
View Related
May 1, 2011
My script.
This is may script:
Code:
Problem: Output file doest not exclude the values in grep -av
View 3 Replies
View Related
Sep 1, 2009
I have a dataset (see example below) that I would like to go through and copy all lines containing a certain string ("LGIG") plus the line immediately following that line to a new file. I have no problem grepping lines containing the string LGIG but I'm lost how to translate that to line number and shift up one line number for each instance of that string.
Example input file:
[code].....
View 5 Replies
View Related
Jan 21, 2011
Ive installed Ubuntu recently but none of my attempts to get the wifi network working were successfull. It establishes connection but the indicator shows no signal and I cant connect to any website, I tried pinging external IPs etc. None of these worked. lspci -nn | grep 'Wireless Brand'Does not show anything. I could find 03:00:0 Network Controller: Intel Corporation Ultimate N WiFi Link 5300 lsmod | grep "wlan_module_name"Doesnt show anything. Restarting network says only: *Reconfiguring network interfaces... Kernel boot messages:
[Code]....
The network Im trying to connect to is hidden, so I have to input SSID manually, I doubt this causes the problem.
View 2 Replies
View Related
Oct 22, 2010
copy string a to string b and change string b with toupper() and count the chars
View 3 Replies
View Related
May 13, 2011
How to set a size string format so that it will show size in megabytes + "MB"?
For example not code...
View 1 Replies
View Related
Nov 22, 2010
I need to kind of grep within grep. My input file would be something like:
[Code]....
and I need to find the first occurrence of hello before MY PATTERN (hello 9008 in this case), so the output should be:
[Code]....
View 4 Replies
View Related
Jun 18, 2010
ii gtk2-engines1:2.20.1-1theme engines for GTK+ 2.x
ii hicolor-icon-theme0.11-1 default fallback theme for FreeDesktop.org icon themes
ii libobrender21 3.4.11.1-1 rendering library for openbox themes
[code]....
View 1 Replies
View Related
Jun 22, 2010
I want to know what's going on here. I'm used to find files in my Debian box usingfind / -type f -print0 | xargs -0 grep -l "foo"but it's been a while since this type of search simply stops at the /proc/kcore directory. I know it has something to do with memory. Is this normal?
View 1 Replies
View Related
May 3, 2011
I've been trying to understand pthread in C a little better. So I made a simple program that takes in a string from the command line and creates a thread to print the string. I've looked online and copied the basic concepts but there are something things I'm confused about. The programs works just fine, but I have questions. Here's what I have so far.
[Code]....
One thing I'd like to know is why the 3rd argument in the pthread_create function which is my SendMessage function needs to be typecasted to a void pointer and then send the address of the function. Also as for the 4th argument, I would see typecasting to void pointer in some of the pthread examples I saw online, but in my case I'm passing a char pointer, would this be correct? In which case would I ever want to pass a void pointer?
Do I need a pthread_exit(NULL) in my main and in the SendMessage function? If so, why? I added the sleep() function so that I could let the pthread_exit function in my SendMessage function execute first. I simply saw that the online examples on pthread had pthread_exit() in both locations.
View 6 Replies
View Related