从命令行 unix 查找和替换 [英] find and replace from command line unix

查看:58
本文介绍了从命令行 unix 查找和替换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个多行文本文件,其中每一行都有格式

I have a multi line text file where each line has the format

..... Game #29832: ......

我想将字符1"附加到每行的每个数字(每行都不同),有人知道从命令行执行此操作的方法吗?

I want to append the character '1' to each number on each line (which is different on every line), does anyone know of a way to do this from the command line?

谢谢

推荐答案

使用sed:

cat file | sed -e 's/\(Game #[0-9]*\)/\11/'

这篇关于从命令行 unix 查找和替换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆