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