Raspberry Pi_Kor_10.9.1 “awk” 명령

10.9 자료 조작 관련 명령

10.9.1 “awk” 명령

“awk” 명령어는 지정된 파일을 읽어 지정된 패턴과 일치하는 값을 가지고 있는 행을 찾고, 패턴이 일치하면 지정된 연산작업을 수행한다. 여기서의 연산은 라인 내의 필드 조작이나 필드 값을 이용한 산술 연산을 의미한다. “awk”라는 이름은 이를 개발한 세 사람의 이름 Aho, Weinberger, Kernighan에서 유래된 것이다.

“awk”는 Shell 프로그래밍과 BC, C 프로그래밍 언어와 같은 기능을 갖춘 프로그래밍 언어로 BC와 같이 완벽하게 작동하며 Shell의 인수인 $1, $2, $3과 같은 이름을 가진 필드 변수가 각 입력 라인에 사용될 수 있다. 또 C 언어와 유사한 프린팅, 제어 연산자도 가지고 있다.

Raspberry Pi_Eng_10.9.1 “awk” Command

10.9 Commands Related to Data Manipulation

10.9.1 “awk” Command

The “awk” command reads the specified file, finds the line that has a value matching the specified pattern, and performs the specified operation if the pattern matches. Here, the operation means a field manipulation in a line or an arithmetic operation using a field value. The name “awk” comes from the names of three people who developed it, Aho, Weinberger, and Kernighan.

Awk is a programming language with features such as Shell programming, BC, and the C programming language. It works perfectly with BC, and field variables with names like Shell arguments $1, $2, and $3 can be used on each input line. It also has a printing and control operator similar to the C language.