相关疑难解决方法(0)

Sed 脚本 - 反转名称

我有一个文本文件,其中有几个名字,名字排在第一位,姓氏排在第二位。如何使用 Sed 颠倒此名称顺序,以便姓氏在前,名字在后?

例如,我有如下几行

Steve Blenheim:238-923-7366:95 Latham Lane, Easton, PA 83755:11/12/56:20300
Betty Boop:245-836-8357:635 Cutesy Lane, Hollywood, CA 91464:6/23/23:14500
Igor Chevsky:385-375-8395:3567 Populus Place, Caldwell, NJ 23875:6/18/68:23400
Run Code Online (Sandbox Code Playgroud)

我希望他们看起来像

Blenheim Steve:238-923-7366:95 Latham Lane, Easton, PA 83755:11/12/56:20300
Boop Betty:245-836-8357:635 Cutesy Lane, Hollywood, CA 91464:6/23/23:14500
Chevsky Igor:385-375-8395:3567 Populus Place, Caldwell, NJ 23875:6/18/68:23400
Run Code Online (Sandbox Code Playgroud)

sed

2
推荐指数
1
解决办法
2096
查看次数

标签 统计

sed ×1