0
votes
1answer
112 views

redirect awk information to stdout

I am trying to gather information for CPU use for all the processors in a text file. mpstat -P ALL -u 1 | awk '{print $4}' > cpu.txt && mptat -P ALL -u 1 | awk '{print $4}' | tee cpu.txt ...
0
votes
1answer
226 views

how to redirect output of command line execution to more than one file according to weight of output

Currently I'm using an awk line to filter a set of files according to certain criteria. How can I redirect the result output to more than one file if the result, for example if the file that would ...
3
votes
3answers
3k views

How to pipe awk output (with periodic, continuous input) to output file?

I am trying to write a command that pipes the continuous output of a free command (run every second) to an awk command that parses a specific value (available free memory) and outputs this to a file ...
2
votes
2answers
347 views

What's the best command to use to change a timestamp to readable date when 'tail -f'-ing a log file?

I have a program which logs like this: 1324218770.7644 INFO etc What's the best Linux shell program to pipe that through to change the timestamps to a human readable format like Sun 18 Dec 2011 ...
1
vote
1answer
550 views

How to solve “Broken Pipe” error when using awk with head

I'm getting broken pipe errors from a command that does something like: ls -tr1 /a/path | awk -F '\n' -vpath=/prepend/path/ '{print path$1}' | head -n 50 Essentially I want to list (with absolute ...
1
vote
2answers
671 views

File name with spaces piped to two xargs commands

I have a directory and many more subdirectories like the following - file with spaces.txt filewithsuperlonglines.txt ordinaryfile.txt binaryfile.bin The command - find . -type f -print0 | ...
0
votes
1answer
688 views

“find | grep | awk” fails miserabily

I'm scanning for all shell scripts on my server, and are doing this by the following command: find / -type f -exec file --mime-type {} \; | grep "text/x-shellscript" This is working fine, and here ...