shell中逐行处理文件

下面的代码展示了如何逐行处理文件

#!/bin/bash

INFILE=$1
OUTFILE=$2

#empty out file
>$OUTFILE

#redirection in file at the bottom
while read line; do
    echo $line >> $OUTFILE
done < $INFILE

猜你喜欢

转载自zzuwxf.iteye.com/blog/1401241