找回密码
 注册
搜索
[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
查看: 23729|回复: 5

[文本处理] 批处理怎样将txt里面的文本内容全部转换成大写?

[复制链接]
发表于 2015-11-11 20:16:19 | 显示全部楼层 |阅读模式
有个文本文档 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:10 | 显示全部楼层
本帖最后由 依山居 于 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.
复制代码
发表于 2015-11-11 20:27:27 | 显示全部楼层
本帖最后由 依山居 于 2015-11-11 20:33 编辑

  1. with open("1.txt") as f:
  2.         txt=f.read()
  3.         upper=txt.upper()
  4.         print(upper)
复制代码
大python
发表于 2015-11-11 20:34:10 | 显示全部楼层
  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
发表于 2015-11-11 22:59:57 | 显示全部楼层
  1. gawk "{print toupper($0)}" 1.txt > 2.txt
复制代码
发表于 2015-11-11 23:00:59 | 显示全部楼层
  1. sed "y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/" 1.txt > 2.txt
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|批处理之家 ( 渝ICP备10000708号 )

GMT+8, 2026-3-18 09:14 , Processed in 0.018734 second(s), 8 queries , File On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表