2
votes
4answers
242 views

Only cat from specific line X (with a pattern) to other specific line Y (with a pattern)

A little extended problem from "cat line x to line y on a huge file": I have a huge file (2-3 GB). I'd like to cat/print only from the line having "foo:" to the line having "goo:". Assume that "foo:" ...
3
votes
1answer
86 views

Grep with spaces suddenly doesn't work

When performing a grep like: $ tail -f apilog_2014.07.09.log | grep "HELLO" | grep "99999" I get the desired output: 12:22:35 server apache2: HELLO FRIEND 99999 12:22:35 server apache2: HELLO ...
1
vote
1answer
253 views

how do i redirect output from tailf & grep to a file [duplicate]

All I wanted is to grep for specific lines in an ongoing log and re-direct it to some file.. tailf log | grep "some words" Now, I want the above command output to get re-directed to some file in ...
0
votes
1answer
57 views

Need to grep for specific lines from ongoing log and save it in some file

So, let me start with the overall outcome that i want to achieve. There is just one log, which will have info on certain devices, that i am upgrading. I use "tailf log" to monitor the log. Now, ...
8
votes
4answers
2k views

Grep from the end of a file to the beginning

I have a file with about 30.000.000 lines (Radius Accounting) and I need to find the last match of a given pattern. The command: tac accounting.log | grep $pattern gives what I need, but it's too ...
2
votes
1answer
655 views

Search and Filter Text on large log files

I use the tail, head and grep commands to search log files. Most of the time the combination of these 3 commands, in addition to using pipe, gets the job done. However, I have this one log that many ...
2
votes
1answer
737 views

Issue with real-time log inspecting piping tail, grep and cut

I have to inspect a growing log in real time, and I found an issue that makes me miss some lines (I can't understand exactly what lines) using tail -f or tailf, grep and cut. I use grep because I ...
2
votes
2answers
725 views

Tail -f piped through grep not outputing to file, but outputs to console

I'm using the following command tail -f /mydir/myfile | grep "searchterm" >> outfile Without the -f it works fine, but with the -f, which I need, nothing is written to the file. The ...
3
votes
2answers
3k views

How to use tail -f with grep to show surrounding lines

I would like to see the output in a logfile greped by only one domain but also the following two lines. Example: tail -f /var/log/apache2/modsec_audit.log |grep mydomain.de this shows all lines, ...
16
votes
3answers
5k views

Piping from grep to awk not working

I am trying to grep the ongoing tail of file log and get the nth word from a line. Example file: $ cat > test.txt <<EOL Beam goes blah John goes hey Beam goes what? John goes forget it Beam ...
1
vote
2answers
664 views

Is there any other way to use tail -f for grep -q && operation?

I found this solution: http://stackoverflow.com/questions/7178888/grep-q-not-exiting-with-tail-f but is there any other possible? UPD: I want to do tail -f | grep -q something && echo ...
2
votes
2answers
3k views

Add carriage return to output of `tail` while using `grep`

I'm looking to refactor the following command: tail -f production.log | grep -e "Processing " -e "compatible;" -e "Completed in " -e This is the output of the command: Processing ...
11
votes
7answers
10k views

grep and tail -f?

Is it possible to do a tail -f (or similar) on a file, and grep it at the same time? I wouldn't mind other commands just looking for that kind of behavior.