티스토리 뷰
특정 문자열과 일치하는 내용을 가지고 있는 파일을 확인하고 싶을 때
grep 을 이용하여 내용을 확인할 수 있다.
-L, --files-without-match
Suppress normal output; instead print the name of each input file from which no output would normally have been printed. The scanning will stop on the first match.
-l, --files-with-matches
Suppress normal output; instead print the name of each input file from which output would normally have been printed. The scanning will stop on the first match. (-l is specified by POSIX.)
<문자열과 일치하는 파일 확인>
> echo a > a.txt
> echo b > b.txt
<파일 확인>
grep [-l][-L] 문자열 파일위치
-l : 일치하는 파일
-L : 일치하지 않는 파일
> grep -l a *
a.txt
> grep -L a *
b.txt
<문자열과 일치하는 파일의 라인 번호 확인>
> cat a.txt | grep -n a
1:a
반응형
'리눅스 > Bash' 카테고리의 다른 글
[bash] 쉘 스크립트에서 문자열에 특정 문자가 존재하는지 확인하여 처리 (0) | 2017.05.23 |
---|---|
[ssh] ssh 명령으로 접속시 인증서 확인 건너뛰기 (0) | 2017.05.19 |
[linux][file] 압축파일의 어떤 형식인지 확인하는 file 명령어 (0) | 2017.02.24 |
[bash][sed] 파일의 문자열 치환하기 (0) | 2017.01.16 |
[bash] rdate 명령을 이용한 리눅스 서버 시간 동기화 (0) | 2016.12.27 |
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- Tez
- error
- emr
- HDFS
- 하둡
- 다이나믹
- oozie
- mysql
- SPARK
- 오류
- Python
- build
- SQL
- 알고리즘
- 정올
- Hadoop
- yarn
- AWS
- airflow
- nodejs
- ubuntu
- Linux
- 백준
- S3
- 하이브
- java
- hbase
- bash
- 파이썬
- HIVE
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
글 보관함