标题: [文本处理] 批处理怎样将txt里面的文本内容全部转换成大写? [打印本页]
作者: luotexiaozh 时间: 2015-11-11 20:16 标题: 批处理怎样将txt里面的文本内容全部转换成大写?
有个文本文档 1.txt,里面的内容类似如下:
Alibaba Group saw its gross merchandize volume breaking last year's record within half a day after the 24-hour online shopping festival kicked off on Nov 11.
The e-commerce giant announced earlier Wednesday its unaudited figure, saying the gross merchandize volume on its Tmall platform reached 57.1 billion yuan ($8.98 billion) at 11:50 am and about 71.61 percent out of the volume generated from mobile channels, such as smartphones and tablets.
现在想把这个txt的内容全部转换成大写!!!
作者: 依山居 时间: 2015-11-11 20:24
本帖最后由 依山居 于 2015-11-11 20:29 编辑
http://batch-cn.qiniudn.com/tool/CCase.exe- o( ̄▽ ̄)o 2015/11/11 周三20:28:50.40 <( ̄︶ ̄)>
- c:\>ccase /?
- CCase 2.7 - (C) 2004-2010 by Bill Stewart (bstewart@iname.com)
-
- Usage: ccase [-u | -l]
-
- -u Converts to uppercase (default).
- -l Converts to lowercase.
-
- Converts each line of standard input to upper or lowercase.
复制代码
作者: 依山居 时间: 2015-11-11 20:27
本帖最后由 依山居 于 2015-11-11 20:33 编辑
- with open("1.txt") as f:
- txt=f.read()
- upper=txt.upper()
- print(upper)
复制代码
大python
作者: 依山居 时间: 2015-11-11 20:34
- c:\>str /?
- Str 2.7 - (C) 2004-2010 by Bill Stewart (bstewart@iname.com)
-
- Usage: str [-c | -l | -u] string
- or: str [-i] -p string1 string2
-
- -c Echoes the number of character in string (count).
- -l Echoes the specified string in lowercase.
- -u Echoes the specified string in uppercase.
- -p Echoes the starting position of string2 in string1 (-1 = not found).
- -i Specifies a case-insensitive comparison (must appear before -p).
复制代码
http://batch-cn.qiniudn.com/tool/Str.exe
作者: DAIC 时间: 2015-11-11 22:59
- gawk "{print toupper($0)}" 1.txt > 2.txt
复制代码
作者: DAIC 时间: 2015-11-11 23:00
- sed "y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/" 1.txt > 2.txt
复制代码
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |