I want to replace a newline byte on a single-byte file with a sed
-(mar. déc. 05 11:45:16)--(moddgsa001.a2297:/home/marc/avirer)-
[root] # ls -l
total 4
-rw-r--r--. 1 root root 1 5 déc. 11:45 saut-de-ligne_UTF-8
-(mar. déc. 05 11:53:52)--(moddgsa001.a2297:/home/marc/avirer)-
[root] # od -h saut-de-ligne_UTF-8
0000000 000a
0000001
-(mar. déc. 05 11:53:57)--(moddgsa001.a2297:/home/marc/avirer)-
[root] # sed -i 's/\x0a/\x25/g' saut-de-ligne_UTF-8
-(mar. déc. 05 11:54:06)--(moddgsa001.a2297:/home/marc/avirer)-
[root] # od -h saut-de-ligne_UTF-8
0000000 000a
0000001
But this does nothing. I don’t understand. Any ideas?
>Solution :
Perl to the rescue!
perl -i -pe 's/\x0a/\x25/' saut-de-ligne_UTF-8