|#!/bin/bash | sh

|^^|

source:

http://ryanstutorials.net/bash-scripting-tutorial/bash-input.php

code:

#!/bin/bash

# A basic summary of sales report

# source: http://ryanstutorials.net/bash-scripting-tutorial/bash-input.php

echo Here the summary of the sales report

echo ====================================

echo

cat /dev/stdin | cut -d' ' -f 2,3 | sort

practice file:

cat salesdata.txt

Fred apples 20 January 4

Sussy oranges 5 January 7

Mark Watermelons 12 January 10

Terry peaches 7 January 15

execute the command:

[rex@ssi bash-sales_report]$ cat salesdata.txt | sh summary.sh

Here the summary of the sales report

====================================

apples 20

oranges 5

peaches 7

Watermelons 12

eof