在文件的每一行之后添加額外的行我需要大約1000行文件的以下任務(wù)的幫助。輸入 ./create.pl 1eaj.out ./create.pl 1ezg.out ./create.pl 1f41.out ...輸出 ./create.pl 1eaj.out mv complex.* 1eaj ./create.pl 1ezg.out mv complex.* 1ezg ./create.pl 1f41.out mv complex.* 1f41 ...我知道以下命令可以添加新行和第一部分,從而使輸出如下所示。 awk ' {print;} NR % 1 == 0 { print "mv complex.* "; }' ./create.pl 1eaj.out mv complex.* ./create.pl 1ezg.out mv complex.* ./create.pl 1f41.out mv complex.* ...剩下的怎么辦?在此先多謝。
3 回答

哆啦的時光機
TA貢獻1779條經(jīng)驗 獲得超6個贊
使用空格或點作為分隔符以提取所需的單詞:
awk -F '[[:blank:].]+' '{print; print "mv complex.*", $4}' filename
添加回答
舉報
0/150
提交
取消