User Tools

Site Tools


awk

This is an old revision of the document!


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.1443542097.txt.gz · Last modified: 2023/08/18 18:15 (external edit)