我有一个文件,内容格式如下
LastnameA,FirstnameA
LastnameB,FirstnameB
LastnameC,FirstnameC
LastnameD,FirstnameD (etc.)
我希望它具有以下形式:
FirstnameA LastnameA
FirstnameB LastnameB
FirstnameC LastnameC
FirstnameD LastnameD (etc.)
是否有不错的awk
或sed
命令来执行此操作?
答案 0 :(得分:3)
以逗号分隔,然后像这样反向打印令牌:
awk -F, '{print $2, $1}'