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: 2023/08/18 18:15 by 127.0.0.1