awk

2023. 8. 1. 22:56리눅스 실제 사용 팁/bash

작성일 : 2016. 10. 23

 

Snippet 모음.

 

제대로 된 기사는 문제가 해결된 후에^^

이틀동안 마누라의 눈치를 보며 awk 문법을 알아내느라 고심 중....

 

Array 길이 출력하기)

echo "hello world" | awk '{n=split($0, array, " ")} END{print n }'
---
[설명]
n 에 길이가 들어간다.

 

http://www.jonathanhui.com/unix-linux-awk-command

http://www.thegeekstuff.com/2010/02/awk-conditional-statements/

https://www.chemie.fu-berlin.de/chemnet/use/info/gawk/gawk_13.html

http://stackoverflow.com/questions/9351902/how-can-i-get-the-length-of-an-array-in-awk