awk
awk '{print "exec DmsPerfDB..UpdateFourGroupSubType "$0" \ngo\n"}' temp.txt | sed "s/a/a/" >>query.sql
结果:
exec DmsPerfDB..UpdateFourGroupSubType NE40E-81|Tunnel0/0/193
go
exec DmsPerfDB..UpdateFourGroupSubType NE40E-81|Tunnel0/0/193
go
exec DmsPerfDB..UpdateFourGroupSubType NE40E-81|Tunnel0/0/193
go
怎么能变为
exec DmsPerfDB..UpdateFourGroupSubType 'NE40E-81|Tunnel0/0/193'
go
exec DmsPerfDB..UpdateFourGroupSubType 'NE40E-81|Tunnel0/0/193'
go
exec DmsPerfDB..UpdateFourGroupSubType 'NE40E-81|Tunnel0/0/193'
go
awk '{print "exec DmsPerfDB..UpdateFourGroupSubType "'\''"$0"'\''" \ngo\n"}' temp.txt
[解决办法]
sed "s/a/a/" >>query.sql