如何使用 SED 从文件中删除 CTRL-A 字符? [英] How to remove CTRL-A characters from file using SED?

查看:46
本文介绍了如何使用 SED 从文件中删除 CTRL-A 字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 SED 从文件中删除所有^A"控制字符.我可以使用 'sed s/[[:cntrl:]]//g' 删除所有控制字符,但我如何具体指定^A"?

I want to remove all "^A" control characters from a file using SED. I can remove all control characters using 'sed s/[[:cntrl:]]//g' but how can I specify "^A" specifically?

推荐答案

要重现^A"只需按 Ctrl-v Ctrl-a 这将重现文件中的 ^A

to reproduce "^A" simply press Ctrl-v Ctrl-a this will reproduce the ^A in the file

sed -i -e 's/^A/BLAH/g' testfile

该行中的 ^A 是我按 Ctrl-v Ctrl-a

the ^A in that line is the result of me pressing Ctrl-v Ctrl-a

这篇关于如何使用 SED 从文件中删除 CTRL-A 字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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