小编mad*_*ist的帖子

具有10列的行将被修改为具有3列的行

我有一个巨大的数据文件,每行包含10列.必须重新排列,使其每行包含3列.sed或awk或perl可以为我做这个吗?例如,以下行

 -6.222  -5.809  43.663   3.778  -5.809  43.663   7.784   5.483 -14.013   6.873
  5.197 -13.865   5.648  -0.107 -14.156   5.485  -1.058 -14.103  -0.809   7.565
-11.708  -1.157   6.740 -11.343  -0.687  -7.913 -15.833  -0.823  -8.865 -15.733
Run Code Online (Sandbox Code Playgroud)

必须成为

 -6.222  -5.809  43.663 
  3.778  -5.809  43.663 
  7.784   5.483 -14.013 
  6.873   5.197 -13.865 
  5.648  -0.107 -14.156
  5.485  -1.058 -14.103
 -0.809   7.565 -11.708
 -1.157   6.740 -11.343
 -0.687  -7.913 -15.833
 -0.823  -8.865 -15.733
Run Code Online (Sandbox Code Playgroud)

我感谢您的帮助.谢谢!

regex perl awk sed pattern-matching

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

重命名命令无法按预期工作

我使用'rename'命令重命名一组文件; 例如:

    inputcac1010.inp.log  inputcac1110.inp.log  inputcac1210.inp.log  inputcac1310.inp.log
    inputcac1020.inp.log  inputcac1120.inp.log  inputcac1220.inp.log  inputcac1320.inp.log
    inputcac1030.inp.log  inputcac1130.inp.log  inputcac1230.inp.log  inputcac1330.inp.log
    inputcac1040.inp.log  inputcac1140.inp.log  inputcac1240.inp.log  inputcac1340.inp.log
    inputcac1050.inp.log  inputcac1150.inp.log  inputcac1250.inp.log  inputcac1350.inp.log
    inputcac1060.inp.log  inputcac1160.inp.log  inputcac1260.inp.log  inputcac1360.inp.log
    inputcac1070.inp.log  inputcac1170.inp.log  inputcac1270.inp.log  inputcac1370.inp.log
    inputcac1080.inp.log  inputcac1180.inp.log  inputcac1280.inp.log  inputcac1380.inp.log
    inputcac1090.inp.log  inputcac1190.inp.log  inputcac1290.inp.log  inputcac1390.inp.log
    inputcac1100.inp.log  inputcac1200.inp.log  inputcac1300.inp.log  inputcac1400.inp.log
Run Code Online (Sandbox Code Playgroud)

必须重命名为

    inputcac1010.log  inputcac1110.log  inputcac1210.log  inputcac1310.log
    inputcac1020.log  inputcac1120.log  inputcac1220.log  inputcac1320.log
    inputcac1030.log  inputcac1130.log  inputcac1230.log  inputcac1330.log
    inputcac1040.log  inputcac1140.log  inputcac1240.log  inputcac1340.log
    inputcac1050.log  inputcac1150.log  inputcac1250.log  inputcac1350.log
    inputcac1060.log  inputcac1160.log  inputcac1260.log  inputcac1360.log
    inputcac1070.log  inputcac1170.log  inputcac1270.log  inputcac1370.log
    inputcac1080.log  inputcac1180.log  inputcac1280.log  inputcac1380.log
    inputcac1090.log  inputcac1190.log  inputcac1290.log  inputcac1390.log
    inputcac1100.log …
Run Code Online (Sandbox Code Playgroud)

bash shell glob rename file

0
推荐指数
1
解决办法
2383
查看次数

为连接字符python赋值

我正在尝试解决一个问题,即将值赋给变量很方便,它本身就是两个字符串的串联.显然,我收到了错误:

SyntaxError: can\'t assign to operator
Run Code Online (Sandbox Code Playgroud)

我试图让它工作的部分代码:

char1 = 'a'
char2 = 'b'

char1+char2 = [element1,element2]
Run Code Online (Sandbox Code Playgroud)

我正在尝试将列表分配给名为ab的新变量.我为我的天真而道歉.建议好吗?

python shell scripting

0
推荐指数
1
解决办法
47
查看次数

标签 统计

shell ×2

awk ×1

bash ×1

file ×1

glob ×1

pattern-matching ×1

perl ×1

python ×1

regex ×1

rename ×1

scripting ×1

sed ×1