Hi All,
I want to delimit the output using awk.
For eg::
a,b,c,d,e,f
abc,def,ghi
should change to
a|b|c|d|e|f
abc|def|ghi
Or to put in another way..
OFS will work in the following code if I seperate the values with comma (eg. $1,$2,$3,$4,$5,$6 ). But since the no. of fields are variable, I might have to use some more lengthy steps.
Is there some way to make OFS work if I use following code (or little variation)..
str="a,b,c,d,e,f"
echo "$str" | awk -F"," 'BEGIN{OFS="|"}{print $0}'
Thanks..