"리눅스 파일 특정 행 보기"의 두 판 사이의 차이

12번째 줄: 12번째 줄:
11번행에서 탐색을 종료하여 속도를 높힌다.
11번행에서 탐색을 종료하여 속도를 높힌다.


==예시==
==실행예시==
<source lang='dos'>
<source lang='dos'>
[root@myhost ~]# cat /etc/issue
[root@myhost ~]# cat /etc/issue

2012년 1월 12일 (목) 14:03 판

1 기본

  • test.txt 파일에서 10번행 가져오기
sed -n 10p < test.txt

2 고급

  • test.txt 파일에서 10번행 가져오기. (더 빠르게 하기)
sed -n '10p;11q' < test.txt

11번행에서 탐색을 종료하여 속도를 높힌다.

3 실행예시

[root@myhost ~]# cat /etc/issue
CentOS release 5.7 (Final)
Kernel \r on an \m

[root@myhost ~]# sed -n 2p /etc/issue
Kernel \r on an \m
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}