我有一个从 EBCDIC 转换为 ASCII 的文件。以前有新行的地方现在显示为 <85>
(代表单个字符的符号,而不是看起来的四个字符),并且整个文件都在一个文件上线。我想搜索它们并再次用新行替换它们,但我不知道该怎么做。
我尝试将光标放在其中一个上并使用 * 搜索下一个匹配项,希望它可能出现在我的 /
搜索历史记录中。这不起作用,它只是搜索 <85>
字符后面的单词。
我搜索了谷歌,但没有看到任何明显的东西。
我的目标是构建一个搜索和替换字符串,例如:
:%s/<85>/\n/g
目前只给我:
E486: Pattern not found: <85>
I have a file that was converted from EBCDIC to ASCII. Where there used to be new lines there are now characters that show up as <85>
(a symbol representing a single character, not the four characters it appears to be) and the whole file is on one line. I want to search for them and replace them all with new lines again, but I don't know how.
I tried putting the cursor over one and using * to search for the next occurrence, hoping that it might show up in my /
search history. That didn't work, it just searched for the word that followed the <85>
character.
I searched Google, but didn't see anything obvious.
My goal is to build a search and replace string like:
:%s/<85>/\n/g
Which currently just gives me:
E486: Pattern not found: <85>
发布评论
评论(3)
我发现“查找和替换vim 中的不可打印字符”搜索 Google。看来您应该能够执行以下操作:
省略
c
在没有提示的情况下进行替换,首先尝试使用c
以确保它正在执行您希望它执行的操作。在 Vim 中,输入
:h \%x
可提供更多详细信息。除了\%x
之外,您还可以使用\%d
、\%o
、\%u
和\%U
表示十进制、八进制、最多四个和最多八个十六进制字符。I found "Find & Replace non-printable characters in vim" searching Google. It seems like you should be able to do:
Omit the
c
to do the replacement without prompting, try withc
first to make sure it is doing what you want it to do.In Vim, typing
:h \%x
gives more details. In addition to\%x
, you can use\%d
,\%o
,\%u
and\%U
for decimal, octal, up to four and up to eight hexadecimal characters.对于特殊字符搜索,以win1252为例,对于
<80>
、<90>
、<9d>
的情况。 。类型:
来自编辑器。
同样,对于八进制、十进制、十六进制,请键入:
/\%oYourCode
、/\%dYourCode
、/\%xYourCode
。For special character searching, win1252 for example, for the case of
<80>
,<90>
,<9d>
...type:
from the editor.
Similarly for octal, decimal, hex, type:
/\%oYourCode
,/\%dYourCode
,/\%xYourCode
.试试这个:
:%s/<85>/^M/g
注意:同时按 Ctrl-V,然后按 M
,或者如果您不介意使用其他工具,
try this:
:%s/<85>/^M/g
note: press Ctrl-V together then M
or if you don't mind using another tool,