Tag Info

Hot answers tagged

3

Add grep's option --line-buffered and sed's option --unbuffered.


2

echo aaaa bbbb ccc bbbb azesd bbbb | tr " " " " | sort | uniq -c | sort -n | tail -n1 outputs 3 bbbb


2

Add option -z to your GNU grep command: cat testfile | grep --color=always -z 'hello' or shorter grep --color=always -z 'hello' testfile


1

This is an old question, but to anyone else wondering the simplest way to do this there is a win utility called "strings" which does exactly what you're after. https://technet.microsoft.com/en-gb/sysinternals/bb897439.aspx Basically, it pulls all the unicode out of files so you can then pipe it to whatever windows grepalike you use be it findstr (native) ...


1

Since the dates are in a format where the chronological order is the same as the lexical order you can simply use awk like this: yourcommand | awk '$0 >= "2015-04-20 18:03:00"' It will output: 2015-04-20 18:06:33 H=(bar.net) [111.176.77.1] F=<foo@bar.net> rejected RCPT <service@charanga.com>: relay not permitted


1

Try this with GNU sed: In pattern space (current line) search (//) a line containg d. Only for those lines append the next line of input into the pattern space (N) and delete pattern space (d). sed '/d/{N;d;}' testing_grep.txt Output: aaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbb bbbbbbbbbbbbbbbbbb cccccccccccccccccc fffffffffffffffff fffffffffffffffff


1

Use grep's --line-buffered option. By default, utilities use line-buffering if their standard output is a terminal, but use bigger buffers (probably 4 or 8 kB) when their output is connected to a file descriptor or a pipe. You're lucky that tail -F uses line-buffering by default, and grep has a command line option to enable that. I'm not aware of a generic ...



Only top voted, non community-wiki answers of a minimum length are eligible