### cut command
cut 옵션 | |
-c | -character |
-b | -bytes |
-d | - delimeter(tab) |
-f | -fields |
-z | -zero-termiated |
## test-data
UNIX is great os. UNIX is opensource. UNIX is free os.
learn operating system.
UNIX LINUX which one you choose.
User is easy to learn. UNIX is a multiuser os. Learn UNIX. UNIX is powerful.
# cut -c 2-4 test-data
// test-file에 2번째부터 4번째까지의 chracter를 출력
# cut -c 10- test-data
// test-file에 10번째부터 마지막까지 chracter를 출력
# cut -c -6 test-data
// test-file에 첫번째부터 6번째까지 chracter를 출력
# cut -c 2,5,7 test-data
// test-file에 2번째, 5번째, 7번째 chracter를 출력
# cp /etc/passwd .
유저 파일을 현재 디렉토리에 복사
# cut -d ":" -f 1 passwd
// passwd 파일에서 :를 기준으로 나눈 후 첫번째 프로토콜을 출력
# cut -d ":" -f 7 passwd
// passwd 파일에서 :를 기준으로 나눈 후 일곱번째 프로토콜을 출력
# cut -d ":" -f 1,7 passwd
// passwd 파일에서 :를 기준으로 나눈 후 첫번째와 일곱번째 프로토콜을 출력
'Linux' 카테고리의 다른 글
리눅스 11일차(3) - Split Command (0) | 2024.03.19 |
---|---|
리눅스 11일차(2) - Paste command (0) | 2024.03.18 |
리눅스 10일차(3) - Shell Script (0) | 2024.03.18 |
리눅스 10일차(2) - Shell Script (0) | 2024.03.18 |
리눅스 10일차(1) - Shell Script (2) | 2024.03.15 |