파일 행 수 세기
파일의 행의 수를 셀 때 다음과 같은 명령어를 사용하면 된다
$cat README.md | wc -l
wc
word count 의 약자
행 수, 단어 수, 바이트 수 등을 세는 리눅스 명령어
wc 옵션 값
$ wc --help
Usage: wc [OPTION]... [FILE]...
or: wc [OPTION]... --files0-from=F
Print newline, word, and byte counts for each FILE, and a total line if
more than one FILE is specified. With no FILE, or when FILE is -,
read standard input. A word is a non-zero-length sequence of characters
delimited by white space.
The options below may be used to select which counts are printed, always in
the following order: newline, word, character, byte, maximum line length.-c, --bytes print the byte counts -m, --chars print the character counts -l, --lines print the newline counts --files0-from=F read input from the files specified by NUL-terminated names in file F; If F is - then read names from standard input -L, --max-line-length print the length of the longest line -w, --words print the word counts --help 이 도움말을 표시하고 끝냅니다 --version 버전 정보를 출력하고 끝냅니다
가장 많이 사용하는 것은 파일의 행의 수를 알아볼때 사용 한다.
$ cat README.md | wc -l 86430125 $ wc -l ./README.md 86430125 ./README.md
참고: https://zetawiki.com/wiki/%EB%A6%AC%EB%88%85%EC%8A%A4_wc
'BackEnd > Linux' 카테고리의 다른 글
Bash 프로그래밍 기초 - 파라미터 받아오기 (0) | 2019.08.20 |
---|---|
Bash 프로그래밍 기초 - If (0) | 2019.08.20 |
Bash 프로그래밍 기초 - for (0) | 2019.08.20 |
Bash 프로그래밍 기초 - array (0) | 2019.08.19 |
Postgresql Install & remove (0) | 2019.06.13 |