Address
304 North Cardinal St.
Dorchester Center, MA 02124

Work Hours
Monday to Friday: 7AM - 7PM
Weekend: 10AM - 5PM

Linux文本操作倒序输出

测试文件:cat test.bat 1. 系统命令:tac test.bat tac test.bat 2.awk方法: awk ‘{aNR=$0}END{for(i=NR;i>0;i–)print ai

Linux文本操作倒序输出-下一朵云

测试文件:cat test.bat

Linux文本操作倒序输出-下一朵云

1. 系统命令:tac test.bat

tac test.bat
Linux文本操作倒序输出-下一朵云

2.awk方法: awk ‘{a[NR]=$0}END{for(i=NR;i>0;i–)print a[i]}’ test.bat

awk '{a[NR]=$0}END{for(i=NR;i>0;i--)print a[i]}' test.bat
Linux文本操作倒序输出-下一朵云

3.sed方法: sed ‘1!G;h;$!d’ test.bat

sed '1!G;h;$!d' test.bat
Linux文本操作倒序输出-下一朵云