I saw a video tutorial for the paste command, in which three files foo,bar,baz were connected horizontally with a "+" sign between.
cat foo 51 33 67 cat bar 10 1 13 cat baz 7 100 15 So, he used a paste command to make each line a whole addition and piped this into a while-loop which iterates through each line and puts it into the bc calculator:
paste -d+ foo bar baz | while read bla;do echo $bla|bc;done I was confused why he used the complicated while-loop since
paste -d+ foo bar baz|bc worked as well,
however this made me thing "Are there situations in which piping into the while-loop makes sense or is even the only way to achieve something?"