awk Assignment Arguments


Example

Assignment arguments appear at the end of an awk invocation, in the same area as file variables, both -v assignments and argument assignments must match the following regular expression. (assuming a POSIX locale)

^[[:alpha:]_][[:alnum:]_]*=

The following example assumes a file file containing the following: 1 2 3 (white space separated)

$ awk '{$1=$1}1' file OFS=, file OFS=- file
1 2 3
1,2,3
1-2-3