如何从命令行在Linux中反转文件的列顺序 [英] How to reverse column order of a file in Linux from the command line
本文介绍了如何从命令行在Linux中反转文件的列顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个名为ip-list
的文件,该文件有两列:
I have a file named ip-list
with two columns:
IP1 <TAB> Server1
IP2 <TAB> Server2
我想生产:
Server1 <TAB> IP1
Server2 <TAB> IP2
什么是最优雅,最短的Linux命令行工具?
What's the most elegant, shortest Linux command line tool to do it?
推荐答案
使用awk:
awk '{print $2,$1}' ip-list
那应该给你你想要的东西.
That should give you what you want.
这篇关于如何从命令行在Linux中反转文件的列顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文