"Awk"의 두 판 사이의 차이

ph
이동: 둘러보기, 검색
잔글
잔글
 
13번째 줄: 13번째 줄:
 
(스페이스도 없애준다)
 
(스페이스도 없애준다)
 
http://stackoverflow.com/a/31849899/766330
 
http://stackoverflow.com/a/31849899/766330
 +
 +
==print except blank lines==
 +
awk NF main.txt > out.txt
 +
[http://fibrevillage.com/scripting/619-ways-to-remove-empty-lines-in-a-file-on-linux#!/ccomment-comment=208]

2019년 9월 5일 (목) 22:12 기준 최신판

split

echo "12|23|11" | awk '{split($0,a,"|"); print a[3],a[2],a[1]}'

[1]

print all but first two columns

\$ # http://stackoverflow.com/a/2961994/766330
\$ cat somefile | awk '{$1=$2=""; print $0}’

아래가 더 나은듯

awk '{sub($1 FS,"")}7' YourFile

(스페이스도 없애준다) http://stackoverflow.com/a/31849899/766330

print except blank lines

awk NF main.txt > out.txt

[2]