I am trying to understand the difference between grep -e and grep -E.
xaos52 wrote:Post output from lspci -knn | grep -EiA2 to see the wifi chipset.Thanks Doc: but there might be sthg missing from your code ... or?tantric tex # lspci -knn | grep -EiA2
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.?Tex-turbed
I want to grep a pattern in some files and count the occurrence with the filename. Right know, if I use
grep -r "month" report* | wc -l
it will sum all instances in all files. So the output is a single value 324343. I want something like this
report1: 3433
report2: 24399
....
The grep command will show the filename but will print every instance.
I would like to get the multi pattern match with implicit AND between patterns, i.e. equivalent to running several greps in a sequence:
grep pattern1 | grep pattern2 | ...
So how to convert it to something like?
grep pattern1 & pattern2 & pattern3
I would like to use single grep because I am building arguments dynamically, so everything has to fit in one string.
Hey Everyone,
I'm having a really hard time figuring this one out.
Using the top command with redirection works fine:
top > top.log
Now I want to use grep to filter a certain line:
top | grep "my_program" > top.log
But the log file will remain empty. But grep delivers an output when using
top | grep "my_program"
Where my_program has to be replaced by a running program to see some output.
Why does my approach not work ? And how can I fix it ?
Hi,
We used to use the below commands often.
Code:
ps -ef|grep [a]bc
ps -ef|grep abc|grep -v grep
Both fairly returns the same result.
For example, the process name is dynamic and we are having the process name in a variable, how we can apply the above trick.
For example "a" is the variable which contains the process name abc, then
Code:
ps -ef|grep $a|grep -v grep
This w
The following script is meant to output "vmstat" for example every 15 seconds, but for some reason it only does this if there's activity or when I kill the script, in other cases it just sits there.
#!/bin/bash
#!/bin/sh
ps -ef | grep -v grep | grep "vmstat 15" | awk '{ print $2 }' | xargs kill
ps -ef | grep -v grep | grep "iostat 15" | awk '{ print $2 }' | xargs kill
ps -ef | grep -v grep |
While running bashscript i.e. checkdump I am getting error.
Quote:
#cat checkdump
#!/bin/bash
cd /dump_restore/outputs/dump/daily/
dt=date | awk '{print $2}'
echo "########Checktime#######"
ls -ltr | tail -1 | awk '{print "cat " $9}' | sh | grep $dt
Output