[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[文本处理] 批处理怎样将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:29 编辑

http://batch-cn.qiniudn.com/tool/CCase.exe
  1. o( ̄▽ ̄)o 2015/11/11 周三20:28:50.40 <( ̄︶ ̄)>
  2. c:\>ccase /?
  3. CCase 2.7 - (C) 2004-2010 by Bill Stewart (bstewart@iname.com)
  4. Usage: ccase [-u | -l]
  5. -u  Converts to uppercase (default).
  6. -l  Converts to lowercase.
  7. Converts each line of standard input to upper or lowercase.
复制代码

TOP

本帖最后由 依山居 于 2015-11-11 20:33 编辑
  1. with open("1.txt") as f:
  2. txt=f.read()
  3. upper=txt.upper()
  4. print(upper)
复制代码
大python

TOP

  1. c:\>str /?
  2. Str 2.7 - (C) 2004-2010 by Bill Stewart (bstewart@iname.com)
  3. Usage: str [-c | -l | -u] string
  4.    or: str [-i] -p string1 string2
  5. -c  Echoes the number of character in string (count).
  6. -l  Echoes the specified string in lowercase.
  7. -u  Echoes the specified string in uppercase.
  8. -p  Echoes the starting position of string2 in string1 (-1 = not found).
  9. -i  Specifies a case-insensitive comparison (must appear before -p).
复制代码
http://batch-cn.qiniudn.com/tool/Str.exe

TOP

  1. gawk "{print toupper($0)}" 1.txt > 2.txt
复制代码

TOP

  1. sed "y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/" 1.txt > 2.txt
复制代码

TOP

返回列表