User Tools

Site Tools


awk

Split a string

$ echo "abc:def:ghi" | awk -F':' '{print $3}'
ghi

Find and Replace with Incrementing Value

$ awk 'BEGIN {i = 0;}{ gsub(/([a-zA-Z0-9_]+)/, "foo"i++); print $0}' test.txt > out.txt
awk.txt · Last modified: 2016/05/14 11:04 (external edit)