bash shell redirecting code block
参考了:https://www.cnblogs.com/sparkdev/p/10247187.html
https://www.tldp.org/LDP/abs/html/redircb.html
awk 用法(使用入门)
awk 用法:awk ' pattern {action} '
----------------------------------------------

#!/bin/bash
E_WRONG_ARGS=71
if [ -z "$1" ]
then
echo "Usage: $0 input-file output-file"
exit $E_WRONG_ARGS
fi
if [ -z "$2" ]
then
echo "Usage: $0 input-file output-file"
exit $E_WRONG_ARGS
fi
FinalName="xxyy"
line_count=$(wc "$1" | awk '{ print $1 }')
for name in $(seq $line_count)
do
read name
echo "$name"
if [ "$name" = "$FinalName" ]
then
break
fi
done < $1 > $2
exit 0

浙公网安备 33010602011771号