我的档案是
cat bla.txt
AbcDe xYaG
需要 Abcde Xyzg
我正在使用sed Didnt工作
cat bla.txt | sed "s/.*/\L&/g" | sed "s/\w/\u&/"
LAbcDe xYaG
谢谢工作
perl -pe 's/\w+/\L\u$&/g'
使用perl,最简单易读的解决方案;)
perl -lne 'print ucfirst for split /\b/, lc' file
要么 :
perl -pe 's/\w+/\L\u$&/g'
学分森迪普•这一个
Abcde Xyag
print() # do what you think
ucfirst() # UPPER case the first letter
for() # perform preceding calls for each element of following list
split(/\b/) # split string on word boundaries
lc() # lower-case each element from splited list
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句