"리눅스 sed 헥스 변경"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-==참고 자료== +==참고==))
4번째 줄: 4번째 줄:
==실습==
==실습==
<source lang='console'>
<source lang='console'>
[root@zetawiki ~]# echo hello > hello.txt
[root@zetawiki ~]# cat greet.txt
[root@zetawiki ~]# hexdump hello.txt
hello
[root@zetawiki ~]# hexdump greet.txt
0000000 6568 6c6c 0a6f                         
0000000 6568 6c6c 0a6f                         
0000006
0000006
</source>
</source>
<source lang='console'>
<source lang='console'>
[root@zetawiki ~]# sed 's/\x68\x65/AB/g' hello.txt
[root@zetawiki ~]# sed 's/\x68\x65/AB/g' greet.txt
ABllo
ABllo
</source>
</source>
<source lang='console'>
<source lang='console'>
[root@zetawiki ~]# sed -i 's/\x68\x65/AB/g' hello.txt
[root@zetawiki ~]# sed -i 's/\x68\x65/AB/g' greet.txt
[root@zetawiki ~]# cat hello.txt
[root@zetawiki ~]# cat greet.txt
ABllo
ABllo
</source>
</source>

2020년 7월 11일 (토) 15:04 판

sed replace with hex
sed 헥스 변경

1 실습

[root@zetawiki ~]# cat greet.txt
hello
[root@zetawiki ~]# hexdump greet.txt
0000000 6568 6c6c 0a6f                         
0000006
[root@zetawiki ~]# sed 's/\x68\x65/AB/g' greet.txt
ABllo
[root@zetawiki ~]# sed -i 's/\x68\x65/AB/g' greet.txt
[root@zetawiki ~]# cat greet.txt
ABllo

2 같이 보기

3 참고

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}