Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
799 views
in Technique[技术] by (71.8m points)

regex - How to remove CTRL-A characters from file using SED?

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...