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 ?
I would like to boot an Arch Linux instance using LXC.
Is there any way to have an echo at the end of a pipe simply append to the current output rather than removing it all?
When I try to extract tty from ps command , at time we get output , at times we dont.
for eg i executed below quesry continulusly for some time,Actually i feel its because sometime pid allocated has some additional space at begining which causes this issue.
->
Code:
ps | grep "/-ksh" | tail -1 | cut -f4 -d' '
echo $a
pts/2
->
Code:
ps | grep "/-ksh" | tail -1 | c
Hello.
I have a question as to why my grep command does not seem to be working.
Code:
grep -c '^[K]?*' ~
Code:
grep -c '^[K].*' ~
I wanted to count the number of files starting with the letter K and have some letters after that. I have such files in my home directory. However, the output is 0. So, I have no ideas why it makes the wrong output. Thanks in advance!!! :o
Hey guys.
I have a command and output as follows.
SUP-STB10-25-eclipse-2009:~# /bin/df |grep -i -v filesystem |/bin/grep %
(se picture for output)
How can i do so the output i get is
58%
0%
6%
0%
63%
63%
63%
63%
in a single line.
the issue is i cant say awk '{print $5}'
since that would print
58%
0%
6%
0%
/v
/v
/t
/a
because of the blank tab in some of the lines.
Thanks on advance.
Kind reg
I am using latest Arch Linux. But whenever I start my PC, it sometimes gets an IP address but most of the time, it gives me stress. I am getting very confused, how can I make sure it is really setting DHCP IP?
This is what I have:
In rc.conf:
DAEMONS=( ...
HI All,
I am using grep command to serach a pattern in a list of files and storing the output in a variable. Then i am applying some logic on that variable to get the required output.
I don't have much experience of using tee, so I hope this is not very basic.
After viewing one of the answers to this question I came across a strange beheviour with tee.