sed 's/.*\(.\)$/\1/' 与 sed 's/.*\///g'都是什么意思
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
-
- 帖子: 28
- 注册时间: 2007-10-19 18:29
sed 's/.*\(.\)$/\1/' 与 sed 's/.*\///g'都是什么意思
这两个都包含一个.*,我不明白是什么意思,还有就是$应该表示是末尾吧,希望哪位可以详细的解释一下这个两个表达式
-
- 帖子: 9
- 注册时间: 2009-10-26 14:49
Re: sed 's/.*\(.\)$/\1/' 与 sed 's/.*\///g'都是什么意思
.*是表示匹配所有,$在这里是行未
第一个意思是把所有以.结尾的行,都替换为.
第二个意思是所有包含V的行,删除这些行V以前包括V在内的字符
第一个意思是把所有以.结尾的行,都替换为.
第二个意思是所有包含V的行,删除这些行V以前包括V在内的字符
- xjpvictor
- 帖子: 2837
- 注册时间: 2007-08-22 15:55
- 系统: Archlinux
- 来自: 新加坡
- 联系:
Re: sed 's/.*\(.\)$/\1/' 与 sed 's/.*\///g'都是什么意思
V?
Entschuldigung. Ich habe keine ahnung.
Secure with PGP: gpg --recv-keys 0x68b6e3d8
Fingerprint: 5556 517C F52F E402 DDF5 5400 6D30 F13E 68B6 E3D8
Towards A Sustainable Earth: Print Only When Necessary
Secure with PGP: gpg --recv-keys 0x68b6e3d8
Fingerprint: 5556 517C F52F E402 DDF5 5400 6D30 F13E 68B6 E3D8
Towards A Sustainable Earth: Print Only When Necessary
- nmsfan
- 帖子: 18958
- 注册时间: 2009-10-16 22:46
- 来自: finland
Re: sed 's/.*\(.\)$/\1/' 与 sed 's/.*\///g'都是什么意思
正则表达式?还看不懂



>>>>推Ubuntu 桌面培训~~<<<<
>>>>想加入/了解gimp汉化吗,点我吧~<<<<
——————————————————————
不推荐wubi,也不推荐你给别人推荐wubi…………
随心而为的感觉真好……
强推mayhem!!
强推ensiferum
>>>>想加入/了解gimp汉化吗,点我吧~<<<<
——————————————————————
不推荐wubi,也不推荐你给别人推荐wubi…………
随心而为的感觉真好……
强推mayhem!!
强推ensiferum
-
- 帖子: 28
- 注册时间: 2007-10-19 18:29
Re: sed 's/.*\(.\)$/\1/' 与 sed 's/.*\///g'都是什么意思
不是V 是\+/。。。。。
- eexpress
- 帖子: 58428
- 注册时间: 2005-08-14 21:55
- 来自: 长沙
- pityonline
- 帖子: 3864
- 注册时间: 2008-12-09 12:44
- 来自: 北京
- 联系:
Re: sed 's/.*\(.\)$/\1/' 与 sed 's/.*\///g'都是什么意思
好像是"\"和"/"……xjpvictor 写了:V?
这句型有点儿像rename后面的,这些东西蛮有意思的,但我不知道具体定义是什么,还得学习啊……
- eexpress
- 帖子: 58428
- 注册时间: 2005-08-14 21:55
- 来自: 长沙
Re: sed 's/.*\(.\)$/\1/' 与 sed 's/.*\///g'都是什么意思
代码: 全选
● cat ansi2html.bash
#!/bin/bash
# Convert ANSI (terminal) colour codes to HTML
# Last Modify: eexpress @ 2009-02-27
# Author:
# http://www.pixelbeat.org/docs/terminal_colours/
echo -n "
<head>
<style type=\"text/css\">
/* linux console palette */
.f0 { color: #000000; }
.f1 { color: #FF0000; }
.f2 { color: #00AA00; }
.f3 { color: #E5E414; }
.f4 { color: #5B5BFC; }
.f5 { color: #FF00FF; }
.f6 { color: #01FEFD; }
.f7 { color: #AAAAAA; }
.bf0 { color: #555555; }
.bf1 { color: #FF5555; }
.bf2 { color: #55FF55; }
.bf3 { color: #FFFF55; }
.bf4 { color: #5555FF; }
.bf5 { color: #FF55FF; }
.bf6 { color: #55FFFF; }
.bf7 { color: #FFFFFF; }
.b0 { background-color: #000000; }
.b1 { background-color: #AA0000; }
.b2 { background-color: #00AA00; }
.b3 { background-color: #CDCD00; }
.b4 { background-color: #0000AA; }
.b5 { background-color: #AA00AA; }
.b6 { background-color: #00AAAA; }
.b7 { background-color: #E5E5E5; }
.bold { font-weight:bold; }
.normal { font-weight:normal; color: #AAAAAA; background-color: #000000; }
.reverse { background-color: #2A2A2A; }
.underline { text-decoration: underline; }
.line-through { text-decoration: line-through; }
.blink { text-decoration: blink; }
</style>
<title>xterm ansi color screenshot -> html</title>
</head>
<html>
<body bgcolor=\"#000000\" text=\"#ffffff\">
<pre>
"
#<meta content="charset=UTF-8">
#<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
#<meta http-equiv="content-type" content="text/html; charset=UTF-8">
p='↗[^↖]*\<'
e='\>[^↖]*'
echo '<span>'
sed 's/\xef\xbf\xbf//g'|\
sed 's#\&#\&#g; s#>#\>#g; s#<#\<#g'|\
#sed 's#\"#\"#g; s#\ +#\ #g'|\
sed 's#\x1b\#[0-9]##g'|\
#sed 's#\x1b\[0m##g'|\
sed 's#\x1b\[\([0-9;]*\)m#↗\1↖#g'|\
sed "s#${p}1${e}#& bold#g"|\
sed "s#${p}4${e}#& underline#g"|\
sed "s#${p}5${e}#& blink#g"|\
sed "s#${p}7${e}#& reverse#g"|\
sed "s#${p}9${e}#& line-through#g"|\
sed "s#${p}3\([0-7]\)${e}#& f\1#g"|\
sed "s#${p}4\([0-7]\)${e}#& b\1#g"|\
#sed "s#↗0↖##g"|\
sed "s#↗[0-9;\ ]\+#</span><span class=\"#g"|\
sed "s#↖#\">#g"|\
#sed "s#^#</span><span class=\"normal\">#g"|\
tr -d "\r"|\
cat
echo '</span>'
echo "</pre>
</body>
</html>
"
● 鸣学
-
- 帖子: 758
- 注册时间: 2006-08-28 9:08
- 来自: 安徽/安庆
Re: sed 's/.*\(.\)$/\1/' 与 sed 's/.*\///g'都是什么意思
好像是火星文字!eexpress 写了:来研究这个吧代码: 全选
● cat ansi2html.bash #!/bin/bash # Convert ANSI (terminal) colour codes to HTML # Last Modify: eexpress @ 2009-02-27 # Author: # http://www.pixelbeat.org/docs/terminal_colours/ echo -n " <head> <style type=\"text/css\"> /* linux console palette */ .f0 { color: #000000; } .f1 { color: #FF0000; } .f2 { color: #00AA00; } .f3 { color: #E5E414; } .f4 { color: #5B5BFC; } .f5 { color: #FF00FF; } .f6 { color: #01FEFD; } .f7 { color: #AAAAAA; } .bf0 { color: #555555; } .bf1 { color: #FF5555; } .bf2 { color: #55FF55; } .bf3 { color: #FFFF55; } .bf4 { color: #5555FF; } .bf5 { color: #FF55FF; } .bf6 { color: #55FFFF; } .bf7 { color: #FFFFFF; } .b0 { background-color: #000000; } .b1 { background-color: #AA0000; } .b2 { background-color: #00AA00; } .b3 { background-color: #CDCD00; } .b4 { background-color: #0000AA; } .b5 { background-color: #AA00AA; } .b6 { background-color: #00AAAA; } .b7 { background-color: #E5E5E5; } .bold { font-weight:bold; } .normal { font-weight:normal; color: #AAAAAA; background-color: #000000; } .reverse { background-color: #2A2A2A; } .underline { text-decoration: underline; } .line-through { text-decoration: line-through; } .blink { text-decoration: blink; } </style> <title>xterm ansi color screenshot -> html</title> </head> <html> <body bgcolor=\"#000000\" text=\"#ffffff\"> <pre> " #<meta content="charset=UTF-8"> #<meta http-equiv="Content-Type" content="text/html;charset=utf-8"> #<meta http-equiv="content-type" content="text/html; charset=UTF-8"> p='↗[^↖]*\<' e='\>[^↖]*' echo '<span>' sed 's/\xef\xbf\xbf//g'|\ sed 's#\&#\&#g; s#>#\>#g; s#<#\<#g'|\ #sed 's#\"#\"#g; s#\ +#\ #g'|\ sed 's#\x1b\#[0-9]##g'|\ #sed 's#\x1b\[0m##g'|\ sed 's#\x1b\[\([0-9;]*\)m#↗\1↖#g'|\ sed "s#${p}1${e}#& bold#g"|\ sed "s#${p}4${e}#& underline#g"|\ sed "s#${p}5${e}#& blink#g"|\ sed "s#${p}7${e}#& reverse#g"|\ sed "s#${p}9${e}#& line-through#g"|\ sed "s#${p}3\([0-7]\)${e}#& f\1#g"|\ sed "s#${p}4\([0-7]\)${e}#& b\1#g"|\ #sed "s#↗0↖##g"|\ sed "s#↗[0-9;\ ]\+#</span><span class=\"#g"|\ sed "s#↖#\">#g"|\ #sed "s#^#</span><span class=\"normal\">#g"|\ tr -d "\r"|\ cat echo '</span>' echo "</pre> </body> </html> "
- xjpvictor
- 帖子: 2837
- 注册时间: 2007-08-22 15:55
- 系统: Archlinux
- 来自: 新加坡
- 联系:
Re: sed 's/.*\(.\)$/\1/' 与 sed 's/.*\///g'都是什么意思
ee那是神族语言
Entschuldigung. Ich habe keine ahnung.
Secure with PGP: gpg --recv-keys 0x68b6e3d8
Fingerprint: 5556 517C F52F E402 DDF5 5400 6D30 F13E 68B6 E3D8
Towards A Sustainable Earth: Print Only When Necessary
Secure with PGP: gpg --recv-keys 0x68b6e3d8
Fingerprint: 5556 517C F52F E402 DDF5 5400 6D30 F13E 68B6 E3D8
Towards A Sustainable Earth: Print Only When Necessary
-
- 帖子: 10
- 注册时间: 2009-01-18 17:09
Re: sed 's/.*\(.\)$/\1/' 与 sed 's/.*\///g'都是什么意思
看不懂,能不能加些注释啊。eexpress 写了:来研究这个吧代码: 全选
● cat ansi2html.bash #!/bin/bash # Convert ANSI (terminal) colour codes to HTML # Last Modify: eexpress @ 2009-02-27 # Author: # http://www.pixelbeat.org/docs/terminal_colours/ echo -n " <head> <style type=\"text/css\"> /* linux console palette */ .f0 { color: #000000; } .f1 { color: #FF0000; } .f2 { color: #00AA00; } .f3 { color: #E5E414; } .f4 { color: #5B5BFC; } .f5 { color: #FF00FF; } .f6 { color: #01FEFD; } .f7 { color: #AAAAAA; } .bf0 { color: #555555; } .bf1 { color: #FF5555; } .bf2 { color: #55FF55; } .bf3 { color: #FFFF55; } .bf4 { color: #5555FF; } .bf5 { color: #FF55FF; } .bf6 { color: #55FFFF; } .bf7 { color: #FFFFFF; } .b0 { background-color: #000000; } .b1 { background-color: #AA0000; } .b2 { background-color: #00AA00; } .b3 { background-color: #CDCD00; } .b4 { background-color: #0000AA; } .b5 { background-color: #AA00AA; } .b6 { background-color: #00AAAA; } .b7 { background-color: #E5E5E5; } .bold { font-weight:bold; } .normal { font-weight:normal; color: #AAAAAA; background-color: #000000; } .reverse { background-color: #2A2A2A; } .underline { text-decoration: underline; } .line-through { text-decoration: line-through; } .blink { text-decoration: blink; } </style> <title>xterm ansi color screenshot -> html</title> </head> <html> <body bgcolor=\"#000000\" text=\"#ffffff\"> <pre> " #<meta content="charset=UTF-8"> #<meta http-equiv="Content-Type" content="text/html;charset=utf-8"> #<meta http-equiv="content-type" content="text/html; charset=UTF-8"> p='↗[^↖]*\<' e='\>[^↖]*' echo '<span>' sed 's/\xef\xbf\xbf//g'|\ sed 's#\&#\&#g; s#>#\>#g; s#<#\<#g'|\ #sed 's#\"#\"#g; s#\ +#\ #g'|\ sed 's#\x1b\#[0-9]##g'|\ #sed 's#\x1b\[0m##g'|\ sed 's#\x1b\[\([0-9;]*\)m#↗\1↖#g'|\ sed "s#${p}1${e}#& bold#g"|\ sed "s#${p}4${e}#& underline#g"|\ sed "s#${p}5${e}#& blink#g"|\ sed "s#${p}7${e}#& reverse#g"|\ sed "s#${p}9${e}#& line-through#g"|\ sed "s#${p}3\([0-7]\)${e}#& f\1#g"|\ sed "s#${p}4\([0-7]\)${e}#& b\1#g"|\ #sed "s#↗0↖##g"|\ sed "s#↗[0-9;\ ]\+#</span><span class=\"#g"|\ sed "s#↖#\">#g"|\ #sed "s#^#</span><span class=\"normal\">#g"|\ tr -d "\r"|\ cat echo '</span>' echo "</pre> </body> </html> "
- Jarson
- 帖子: 2371
- 注册时间: 2008-07-21 9:44
- 来自: 深圳
- 联系:
Re: sed 's/.*\(.\)$/\1/' 与 sed 's/.*\///g'都是什么意思
斗胆分析一下
第一个:只保留一行中的最后一个字符(也许只是一个空格)。
第二个:删除一行中所有以 / 结尾的字符(包括数字等,这里用字符来指代)串。
第一个:只保留一行中的最后一个字符(也许只是一个空格)。
第二个:删除一行中所有以 / 结尾的字符(包括数字等,这里用字符来指代)串。
-
- 帖子: 284
- 注册时间: 2007-12-30 13:17