sed 개행 문자 제거 (정규식)
OS/리눅스 & 유닉스 2012. 5. 15. 14:23-
http://stackoverflow.com/questions/1251999/sed-how-can-i-replace-a-newline-n
sed ':a;N;$!ba;s/\n/ /g' file
- :a create a label 'a'
- N append the next line to the pattern space
- $! if not the last line, ba branch (go to) label 'a'
- s substitute, /\n/ regex for new line, / / by a space, /g global match (as many times as it can)
sed will loop through step 1 to 3 until it reach the last line, getting all lines fit in the pattern space where sed will substitute all \n characters
'OS > 리눅스 & 유닉스' 카테고리의 다른 글
정적 라이브러리, 공유 라이브러리 (1) (0) | 2012.05.18 |
---|---|
프로세스 정보 확인 (AIX), getprocs64 (0) | 2012.05.16 |
Warning : incompatible implicit declaration of built-in function xxxxxxxxx (0) | 2012.04.26 |
kill -0 (0) | 2012.04.26 |
프로세스 (process) (0) | 2012.04.06 |