#!/bin/bash content=`cat test.txt` echo "begin" for i in $content do echo $i done
读取前10行
head -n 10 test.txt
读取后10行
tail -n 10 test.txt
读取第5行
sed -n "5,1p" test.txt
读取5到10行
sed -n “5,10p” test.txt