I am trying to limit the number of lines found during a while read line loop. For example:
123456,ORDER1,NEW 123456,ORDER-2,NEW 123456,ORDER-3,SHIPPED
I am doing the following.
cat order.csv | while read line; do order=$(echo $line | cut -d "," -f 1) status=$(echo $line | cut -d "," -f 3) echo "$order:$status" done
123456:NEW 123456:NEW 123456:SHIPPED
How can I limit the number of lines. In this case there are three. How can I limit them to only 2 so that only the first two are displayed?