specify delimiter in awk code example
Example 1: awk delimiter
# by default, awk uses empty space(s) as field seperator
# we can specify field seperator ourselves using -F flag
# SINGLE field seperator
echo 'a+b=c' | awk -F'=' '{print NF, $1, $2}'
# NF in awk stands for number of fields
# Returns
2 a+b c
# MULTIPLE field seperators
echo 'a+b=c' | awk -F'[+=]' '{print NF, $1, $2, $3}'
# Returns
3 a b c
Example 2: awk delimiter replace
Just use tr command as follows to replace a delimiter:
tr '(' '[' file.txt #replaces parenthesis '(' for brackets '['
tr '()' '[]' file.xt #respectively replaces '(' for '[' and ')' for ']'