awk

wqmgxj 2010-06-04 01:11:29

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
...全文
96 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
wqmgxj 2010-06-04
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 steptodream 的回复:]
你到底是什么shell环境啊 为什么我们测试好用的 你都不好用
[/Quote]

对Solaris不熟悉, shell也第一次弄啊,终于弄好使了
还是用的

awk '{print "exec DmsPerfDB..UpdateFourGroupSubType wqmgxj"$0"wqmgxj \ngo\n"}' temp.txt | sed "s/wqmgxj/\'/" | sed "s/wqmgxj/\'/" >>query.sql

wqmgxj 2010-06-04
  • 打赏
  • 举报
回复
SunOS V240_25 5.10 Generic_137111-07 sun4u sparc SUNW,Sun-Fire-V240
steptodream 2010-06-04
  • 打赏
  • 举报
回复
你到底是什么shell环境啊 为什么我们测试好用的 你都不好用
wqmgxj 2010-06-04
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 steptodream 的回复:]
C/C++ code

awk '{print "exec DmsPerfDB..UpdateFourGroupSubType "'\''"$0"'\''" \ngo\n"}' temp.txt | sed "s/a/a/" >>query.sql



用这个 刚才我失误了
[/Quote]
还是不行,我这只有这个能通
awk '{print "exec DmsPerfDB..UpdateFourGroupSubType wqmgxj"$0"wqmgxj \ngo\n"}' temp.txt | sed "s/wqmgxj/\'/" | sed "s/wqmgxj/\'/" >>query.sql
steptodream 2010-06-04
  • 打赏
  • 举报
回复

awk '{print "exec DmsPerfDB..UpdateFourGroupSubType "'\''"$0"'\''" \ngo\n"}' temp.txt | sed "s/a/a/" >>query.sql


用这个 刚才我失误了
wqmgxj 2010-06-04
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 steptodream 的回复:]
C/C++ code

awk '{print "exec DmsPerfDB..UpdateFourGroupSubType \'"$0"\' \ngo\n"}' temp.txt | sed "s/a/a/" >>query.sql
[/Quote]

在我这怎么就什么不输出呢,
geniusqiao 2010-06-04
  • 打赏
  • 举报
回复
awk 里面单引号转义如下:

echo "test" | awk '{print '\''$0}'
steptodream 2010-06-04
  • 打赏
  • 举报
回复

awk '{print "exec DmsPerfDB..UpdateFourGroupSubType \'"$0"\' \ngo\n"}' temp.txt | sed "s/a/a/" >>query.sql

1,543

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 Solaris
社区管理员
  • Solaris
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧