{{tag>[string replace]}}
====== sed (Stream EDitor) ======
문자열 치환
===== Usage =====
sed -n -e 'command' [input file]
* ''sed [OPTION]... {script-only-if-no-other-script} [input-file]...''
* ''sed **-n**'': 기본 출력을 표시하지 않음. suppress automatic printing of pattern space \\ ''**sed** --quiet'' \\ ''**sed** --silent''
* ''sed --debug'': annotate program execution
* ''sed **-e** script'': 스크립트 추가. add the script to commands to be executed \\ ''**sed** --expreession=script''
* ''sed **-f** script-file'': 스크립트를 파일에서 불러옴. add the contents of script-file to the commands to be executed \\ ''**sed** --file=script-file''
* ''sed --follow-symlinks'': follow symlinks when processing in place
* ''**-i**'' **원본 파일 직접 수정**
* ''**-i.bak**'' **원본 파일 직접 수정 및 백업 작성**
==== command ====
find . | cat -n | sed -e 's/.\/ /'
정규표현식 가능. escape 문자(''\'')
* ''number**p**'': 해당 라인(number) 출력. ''-n''(기본출력 제거)옵션과 자주사용 ++ overloads || \\ ''number,number**p**'' \\ ''number**p**;number**p**;number**p**'' ++
* ''number**d**'': 해당 라인(number) 삭제. ++ overloads || \\ ''number,number**d**'' \\ ''number**d**;number**d**;number**d**'' ++
* ''/search/**d**'': search 삭제
* ''**s**/search/replace/'': 치환(substitute) search검색하고 replace로 대치(첫번째 일치만 치환) \\ ''**s**/search/replace/**g**'': 해당 행의 전체 일치내용 치환