从文件中读取行反向 [英] read line reverse from a file
本文介绍了从文件中读取行反向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何从类似文件的行中读取行反转
how do I read line reverse from a file like,
#cat file
hello world
hello world bash
所以我需要这样的输出
world hello
bash world hello
推荐答案
awk '{for(i=NF;i>=1;i--) if(i!=1)printf $i" ";else print $i}'
world hello
bash world hello
这篇关于从文件中读取行反向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文