1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#!/bin/bash I="" while read; do if echo "$REPLY" | grep -q '^PLA'; then echo "$I$REPLY" I=" $I" else if echo "$REPLY" | grep -q '^leave'; then I=$(echo "$I" |sed 's/ //') else echo "$I$REPLY" fi fi done