-
IFS='\n'; for line in $(cat 1.txt); do echo $line; done; unset IFS
- by piping cat:
cat /path/to/file | while read line do echo $line done
- by redirecting the file:
while read line do echo $line done < /path/to/file
- by using awk:
awk '{print $0}' /path/to/file
- by using head an tail:
f=/path/to/file total=$(wc -l $f) n=0 while [ $n -lt $total ] do let n++ line=$(head -n $n $f | tail -1) echo ${line} done
No comments:
Post a Comment