BASH:Output specified line

sed -i 's/111/222/g' input.txt

awk 'NR == 2' input.txt  #output line2
sed -n 2p input.txt      #output line2

tail -n2 input.txt  #only output the last two lines
tail -n+2 input.txt #from line2 to end
tail -n+2 input.txt|head -n1 #only output line2

猜你喜欢

转载自www.cnblogs.com/xinyueliu/p/12792872.html