Awk给文件中的行前后添加内容

     在配置Oracle goldengate 的复制参数文件时,以前都是用uedit32,后来觉得有点麻烦,用python写脚本,最后用了awk以后,发现这种文件行中前后添加内容的需求还是AWK最方便。

需要复制的表清单test

 cat test 

table1

table2

table3

cat test | awk '{print "map " $0 ", target " $0 ";"}'

map table1, target table1;

map table2, target table2;

map table3, target table3;

一行语句直接搞定