Windows 实用程序可以查找数字并进行运算吗?
是否有这样的东西可以使用正则表达式查找数字并可以对其执行简单的算术运算?
想象一下,您有一个存储位置的源/配置文件,后来更改了现在需要偏移量的代码。如果不手动执行,您通常如何进行此操作?
编辑:我知道我应该在原始帖子中添加这一点。我更喜欢一些小而容易从任何地方获得的东西。我知道 Cygwin 和 Linux 的精彩 util 集,这就是为什么我明确地将 Windows 放在标题中。
Is there such a thing that finds numbers using regex and can perform simple arithmetic operations to it?
Imagine you have a source/config file storing positions and later changed the code which requires an offset now. How do you normally go about this without doing it manually?
Edit: I knew I should've added this bit with the orignal post. I'd prefer something small and easily acquired from anywhere. I am aware of Cygwin and the wonderful util sets of linux which is why I explicitly put Windows in the title.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为自己获取一份 Cygwin 并进行
bash
、方面的培训awk
、sed
、grep
及其兄弟。自 MSDOS 3.3 的愚蠢时代以来,Windows cmd 语言已经取得了长足的进步,但它仍然不是 UNIX 工具后端的一个疣。 Cygwin 为您提供所有这些工具以及更多。
完成特定任务的一种方法(如果我理解正确的话)是更改:
以下命令显示了如何使用 awk 来实现这一点:
这是为了可读性而格式化的 - 我倾向于在一行并从文件中获取我的输入而不是回显它,但这仅用于演示目的。
如果您想要更轻量级的东西(就您必须安装的内容而言 - 它仍然非常强大), GnuWin32 可以为您提供单独的包。只需安装 gawk 或任何您需要的东西即可。
Get yourself a copy of Cygwin and train yourself up on
bash
,awk
,sed
,grep
and their brethren.The Windows cmd language has come a long way since the brain-dead days of MSDOS 3.3 but it's still not a wart on the rear end of the UNIX tools. Cygwin gives you all those tools and more.
A way of doing your specific task (if I understand it correctly) is to change:
The following command shows how to use
awk
to acheive that:That's formatted for readability - I would tend to do it all on one line and get my input from a file rather than echoing it, but this is just for demo purposes.
If you want something a little more lightweight (in terms of what you have to install - it's still very powerrful), GnuWin32 can give you individual packagaes. Just install
gawk
or whatever you need.