항상 그렇지만...
삭제는 ""으로 치환하는거고 그 함수로 sub와 gsub를 지원하는 듯
sub
cat my_list.txt | awk -F '\t' -v OFS='\t' '{ sub("-",".",$3); print }' |
[링크 : http://bahndal.egloos.com/565881]
gsub
awk -F\, '{gsub(/[ \t]+$/, "", $2); print $2 ":"}' |
[링크 : https://stackoverflow.com/questions/9985528/how-can-i-trim-white-space-from-a-variable-in-awk]
sub는 처음 매칭되는 것만 치환, gsub는 전역 치환인듯
sub(r, s [, t])
Just like gsub(), but only the first matching substring is replaced.
gsub(r, s [, t])
For each substring matching the regular expression r in the string t, substitute the string s, and return the number of substitutions. If t is not supplied, use $0. An & in the replacement text is replaced with the text that was actually matched. Use \& to get a literal &. (This must be typed as "\\&"; see GAWK: Effective AWK Programming for a fuller discussion of the rules for &'s and backslashes in the replacement text of sub(), gsub(), and gensub().)
|
[링크 : https://linux.die.net/man/1/awk]