gedit如何实现如下需求

sh/bash/dash/ksh/zsh等Shell脚本
回复
ahlai
帖子: 141
注册时间: 2006-05-03 9:10

gedit如何实现如下需求

#1

帖子 ahlai » 2009-04-23 9:55

int f0/0.12
en 12
no sh
int f0/0.13
en 13
no sh
int f0/0.14
en 14
no sh
上面的是原始数据
想把int f0/0.*换成int f0/0.*\ndu fu ///*代表12到200之间的数字
怎样实现
谢谢
头像
jioyo源
帖子: 3476
注册时间: 2008-10-08 13:48

Re: gedit如何实现如下需求

#2

帖子 jioyo源 » 2009-04-24 2:46

awk '{gsub("int f0/0.*","int f0/0.*\\ndu fu ///*",$0); print $0 >FILENAME}' yourfilename
--------------------------------------
论坛精华贴全集:http://forum.ubuntu.org.cn/viewtopic.php?f=48&t=199845
book:http://forum.ubuntu.org.cn/viewtopic.php?f=21&t=198286
ahlai
帖子: 141
注册时间: 2006-05-03 9:10

Re: gedit如何实现如下需求

#3

帖子 ahlai » 2009-04-25 13:56

jioyo源 写了:awk '{gsub("int f0/0.*","int f0/0.*\\ndu fu ///*",$0); print $0 >FILENAME}' yourfilename
谢谢
头像
hellojinjie
帖子: 1150
注册时间: 2007-09-14 21:03
来自: 浙江

Re: gedit如何实现如下需求

#4

帖子 hellojinjie » 2009-04-25 21:28

其实你直接说用awk 或sed就行了
Say hello to everyday!
头像
jioyo源
帖子: 3476
注册时间: 2008-10-08 13:48

Re: gedit如何实现如下需求

#5

帖子 jioyo源 » 2009-04-25 21:40

hellojinjie 写了:其实你直接说用awk 或sed就行了
:em06
--------------------------------------
论坛精华贴全集:http://forum.ubuntu.org.cn/viewtopic.php?f=48&t=199845
book:http://forum.ubuntu.org.cn/viewtopic.php?f=21&t=198286
回复