Usage: sed [OPTION]... {script-only-if-no-other-script} [input-file]...
-n, --quiet, --silent
suppress automatic printing of pattern space
-e script, --expression=script
add the script to the commands to be executed
-f script-file, --file=script-file
add the contents of script-file to the commands to be executed
-i[SUFFIX], --in-place[=SUFFIX]
edit files in place (makes backup if extension supplied)
-l N, --line-length=N
specify the desired line-wrap length for the `l' command
--posix
disable all GNU extensions.
-r, --regexp-extended
use extended regular expressions in the script.
-s, --separate
consider files as separate rather than as a single continuous
long stream.
-b, --binary
do not convert DOS to UNIX lineendings (only on systems
supporting different lineendings).
-u, --unbuffered
load minimal amounts of data from the input files and flush
the output buffers more often
--help display this help and exit
--version output version information and exit
If no -e, --expression, -f, or --file option is given, then the first
non-option argument is taken as the sed script to interpret. All
remaining arguments are names of input files; if no input files are
specified, then the standard input is read.
practice
줄바꿈의 '\r' 문자 제거하여 다른 이름으로 저장
$ sed -e "s/\r$//" inputfile > newfile
"s/\r$//"
s: substitute (바꾸기)
/: delimiter (구분자)
\r$: 바꿀 문자(열), 여기서는 줄 끝($: end of line)에 오는 \r 문자를 바꿈
마지막 두 개의 delimiter 사이에는 아무 것도 주지 않음으로써 원하는 문자를 제거
-n, --quiet, --silent
suppress automatic printing of pattern space
-e script, --expression=script
add the script to the commands to be executed
-f script-file, --file=script-file
add the contents of script-file to the commands to be executed
-i[SUFFIX], --in-place[=SUFFIX]
edit files in place (makes backup if extension supplied)
-l N, --line-length=N
specify the desired line-wrap length for the `l' command
--posix
disable all GNU extensions.
-r, --regexp-extended
use extended regular expressions in the script.
-s, --separate
consider files as separate rather than as a single continuous
long stream.
-b, --binary
do not convert DOS to UNIX lineendings (only on systems
supporting different lineendings).
-u, --unbuffered
load minimal amounts of data from the input files and flush
the output buffers more often
--help display this help and exit
--version output version information and exit
If no -e, --expression, -f, or --file option is given, then the first
non-option argument is taken as the sed script to interpret. All
remaining arguments are names of input files; if no input files are
specified, then the standard input is read.
practice
줄바꿈의 '\r' 문자 제거하여 다른 이름으로 저장
$ sed -e "s/\r$//" inputfile > newfile
"s/\r$//"
s: substitute (바꾸기)
/: delimiter (구분자)
\r$: 바꿀 문자(열), 여기서는 줄 끝($: end of line)에 오는 \r 문자를 바꿈
마지막 두 개의 delimiter 사이에는 아무 것도 주지 않음으로써 원하는 문자를 제거
'technical' 카테고리의 다른 글
IP (Internet Protocol) 정리 자료 (2) | 2008.10.22 |
---|---|
간단한 Unix Shell Script 강좌 (10) | 2008.07.09 |
핸드폰에서 full browsing을!! (16) | 2008.03.25 |
IMS overview (6) | 2008.03.07 |
H.223 정리 (4) | 2008.03.06 |