首页 > 其他 > 详细

[sed] 将语句中的特定单词转换成大写

时间:2015-09-09 21:15:20      阅读:279      评论:0      收藏:0      [点我收藏+]

$cat text

find the Match statement
Consult the Get statement
using the Read statement to retrieve data

/the .* statement/{
h
s/.*the \(.*\) statement.*/\1/
y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/
G
s/\(.*\)\n\(.*the \).*\( statement.*\)/\2\1\3/
}

 

$sed -f sedsrc text
find the MATCH statement
Consult the GET statement
using the READ statement to retrieve data


 

 

# 将语句的名字编程大写形式
/the .*statement/{
    s/\(.*the\) \(.*\) \(statement.*\)/\1 \U\2\E \3/
}

$sed -f 4.sedsrc text 
find the MATCH statement
Consult the GET statement
using the READ statement to retrieve data

 

[sed] 将语句中的特定单词转换成大写

原文:http://www.cnblogs.com/fanyl5/p/4795755.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!