I'm trying to grep the output of ngrep. Unfortunately when I add another grep to the pipeline, I get no output at all. It can be some other command too - cat / grep / tee - everything breaks the chain. Example:
[Code]....
If I use cat somefile instead of ngrep at the start, everything works as expected.
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.
I have a requirement to find the files having its name as ack_reply. However, there are many other files in the same directory as these resides. Now I have to remove these files from the folder and retain others after 7 days. So I tried to write the below script with grep command.
find $directory -type f -mtime +7 | grep ack_reply
how can I pass this output to -exec command.
If I am not using grep command my script would be as
find $directory -type f -mtime +7 -exec remove.sh {}\;;
Is there some way to filter output of command by OR condition in Linux? There is filtering by AND condition with grep in way like: ls -l | grep "^a" | grep "z$"
That says: list all files that beggins with "a" AND ends with "z" (so there is shorter way to write this: grep "^a.*z$", but it is not matter). Is there some way to perform test by OR condition? For example: files that starts exactly with "xen" OR files that ends exactly with ".rpm". But exactly, not something like: grep "[xen]{0,3}.*[.rpm]{0,4}"
how I cat to filter out information about Unix Domain Sockets from netstat output without grep? Is there some option for command (I not found it in man of netstat).
I would like to grep two numbers out of a text file, and divide them.
Here is the script code...
It feels like grep saves a new line too? or what is happening? i simply can't divide them, as it handles the variables as they are empty (and prints the two numbers although they were not printed
I have some big files of logs that contain errors printed by an app. They are most of the time relevant, however most of them are similar. So i figured i could check what happened between a time interval with a find.
Im using this one
Code:
And I get an output similar to this one.
Code:
Is there a way to condensate the output lines to get only one or two, indicating the start and last occurrence of a block? Or I need to create a program to do so?
Because right now I get thousands of similar lines, but when I'm scrolling through them i sometimes miss relevant information that i would've otherwise noted if it wasn't all that spammy.
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...
I am in the middle of trying to write my first script. I have created a command using sed and grep to grab a list of ftp hosts from a host file. Now I want to test the ftp connection of the hosts that have been returned after running the command.
What If I wanted to scan a string like the following...
[Code]...
Anyhow just one giant string that's longer than my screen's width. If I simply copy and paste that string after a grep command, it seems that the terminal inserts newlines at the terminal's width and therefore not the whole string goes in. Even if I insert a quote before the beginning of the string and then paste it in, terminal still reads in a newlines somehow and obviously says command not found, etc.
I am trying to use a shell script to find a string in a file and do something when found. code...
What should happen is pppd will start in a different process and stream it's output to pppdout. pppdout should be created in the current folder. Then the script should periodically check the pppdout file for the string Script (which eventually will appear, some seconds later) and when found exit the script. Ultimately the script will do something useful when the text is found. However, the output from the program is a repeating: 'scriptname.sh: 12: FOUND: not found'
Where scriptname.sh would be the name of your script and 12 refers to the line with 'done'.
Why does grep not find the text, or at least why deos my script not check the grep output correctly?
Code: man -k mail Which lists commands that contain the keyword "mail" in their description.I want the output of this command in less and the words highlighted by grep. Something like
Code: man -k mail | grep mail | less The command doesn't work, how do I fix it?
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?
where variable would maybe be the output of grep from fileA. So can I store the output of grep in a variable to use it afterwards with awk ?
something like that:
Code: result=`grep prot. fileA` ; awk 'BEGIN { RS = "###" } /'$result'/' fileB > output but that doesn't work. I'm always getting the entire fileB.
The output of grep get stored in the variable, I verified that with echo. So there is something that I just don't get... It seems to me that the above line should work.
I want to write a script that keeps "grepping" strings from the Main page of the Linksys PAP2T every 30 seconds.It seems to be simple:1- lynx -auth=user:password URL2- grep the strings3- process themthe problem is that the page is writed in PHP and Lynx does not clear the authentication credentials with a 401 server response!w3m works.. but I don't know how to set the autologin and how to export the page to a text.With firefox.. I can set the home page as but it ask if it can continue before sending the data.. how can I force it and how can I obtain a text from it?I don't know.
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:
I searched and I found a few threads on this but none answered my question really.I'm using:
Code: curl www.foo.com | grep '<h2>.*.</h2>' Basically I want to extract all instances of Code: <h2>Blah blah blah</h2>
from the page source, but it's not giving me that, it gives me <h2>.. followed by a loads of other stuff that I don't want. I haven't used wildcards with grep before so I don't really know whether I'm doing it right or not.
Let me *try* and explain what I'm trying to do, and keep in mind aside from a little command line stuff I'm a beginner to any of what I'm asking about.
So that whatever was captured in the () in the first part of the statement would be used in the 1 in the back part of the statement for every n.chatlog that might be in any of the /webserver directories at that time.