SED로 같은 행에 단어 추가

https://stackoverflow.com/questions/35252285/insert-text-with-sed-on-the-same-line-that-pattern-search

sed로 정규 표현을 찾아, 같은 라인의 마지막에 삽입하는 명령.

sed 's/\blocalhost\b/& 192.168.25.50/' file
    \b: a zero-width word boundary
    &: refer to that portion of the pattern space which matched

이걸 모르면 ( )와 \1로 개 지랄을 해야 되는데..

코멘트

댓글 남기기

이 사이트는 Akismet을 사용하여 스팸을 줄입니다. 댓글 데이터가 어떻게 처리되는지 알아보세요.