I recently wanted to have a single line for a command that was running two functions:
for i in `(ls -l |awk '{print $9}')`; do echo $i; cat $i|grep failure|wc -l; doneThis gave and output like:
file1
0
file2
0
file3
1But I wanted:
file1 0
file2 0
file3 1The trick, use the -n function on echo like this:
for i in `(ls -l |awk '{print $9}')`; do echo -n "$i "; cat $i|grep failure|wc -l; done