Is there a way to print or tee one thing to the console and still pass something else through to the next pipe? Something like:
echo dog | printOrWhatnot "PUTTING MY THING DOWN" | sed 's/dog/cat/g' | printOrWhatnot "FLIP IT"|rev
that would result in:
PUTTING MY THING DOWN
FLIP IT
tac
EDIT: This should also work with multiline input:
printOrWhatNot() {...}
seq 10 30 |printOrWhatNot searching for 3s | grep 3
would output
searching for 3s
13
23
30
Lars' answer seemed to only pass along the first input (here it would be 10)
Also ideally the output would come inline during processing which wasn't what I was seeing with Glen's answer. So
seq 10 30 |tee /dev/tty |printOrWhatNot searching for 3s | grep 3
would make for:
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
searching for 3s
13
23
30
