当我catsed一个iOS可执行文件时,它总是中断,我得到以下消息:

$ 1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c

当我按回车键时,我得到:
$ 1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c
-bash: 1: command not found
-bash: 2c1: command not found
-bash: 2c1: command not found
-bash: 2c1: command not found
-bash: 2c1: command not found
-bash: 2c1: command not found
-bash: 2c1: command not found
-bash: 2c1: command not found
-bash: 2c1: command not found
-bash: 2c1: command not found
-bash: 2c1: command not found
-bash: 2c: command not found

最佳答案

只要您不向终端输出任何二进制内容,它就应该可以工作。制作副本并使用sed -i就地修改副本:

cp file file.modified
sed -i 's/pattern/replacement/' file.modified

然后使用例如vimdiff来验证更改(在使用fold将新行放入文件之后):
fold -w40 file > file.40
fold -w40 file.modified > file.modified.40
vimdiff file.40 file.40

关于linux - cat/sed一个iOS可执行文件-macOS上的错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/41733442/

10-11 22:05