10

I am unable to type (Control A) characters in a shell script. By using (Ctrl+V) and then (Ctrl+A). I am unable to do so. I am able to give (Ctrl+A) from cli but not in a shell script. I am typing the shell script in vi.

What I am trying to do is write a shell script containing the command sed 's/^A//g', i.e. trying to replace (Ctrl+A) with NULL.

4

2 回答 2

8

@Joy,如果您使用的是 Vi/Vim,请确保您处于插入模式,然后按 (Ctrl+V),然后按 (Ctrl+A) 输入 ^A。抱歉,我真的不明白为什么这不起作用...也许您的 (Ctrl+V) 按键被其他软件层捕获?

于 2014-07-04T15:01:01.163 回答
0

这对我有用:

cat file
This is a test ^A more data

sed 's/\^A//g' file
This is a test  more data
于 2014-07-04T11:25:36.580 回答