I'd like to print command output along with its input. For example for such call as
echo "Hello world" | wc -c
I want the following output:
12,Hello world
Is there any way to do this using standard Unix (or GNU) tools?
I'd like to print command output along with its input. For example for such call as
echo "Hello world" | wc -c
I want the following output:
12,Hello world
Is there any way to do this using standard Unix (or GNU) tools?
tee
and paste
solution:
echo "Hello world" | tee >(wc -c) | tac | paste -s -d, -
12,Hello world
A possibility (I think there should be better ones):
echo `echo "Hello world" | wc -c` ",Hello world" | sed 's/ ,/,/g'