인프라/리눅스
[CentOS7] sed 명령어
IT맥구리나스
2022. 6. 21. 09:33
특정 문자열 아래줄 삭제 후 저장
sed -i '/^seotest/{n;d}' test
$ cat test
vvvvvvvvvvvvvv
seotest
adfadfadzvcvzcvcvz
123213123123
# 명령어 수행
sed -i '/^seotest/{n;d}' test
$ cat test
vvvvvvvvvvvvvv
seotest
123213123123
특정 문자열 아래 문자열 추가
sed -i'' -r -e "/seotest/a\add hello world" test
$ cat test
vvvvvvvvvvvvvv
seotest
123213123123
# 명령어 수행
sed -i'' -r -e "/seotest/a\add hello world" test
$ cat test
vvvvvvvvvvvvvv
seotest
add hello world
123213123123
반응형