gawk FS to split record into individual characters
问题 If the field separator is the empty string, each character becomes a separate field $ echo hello | awk -F '' -v OFS=, '{$1 = NF OFS $1} 1' 5,h,e,l,l,o However, if FS is a regex that can possibly match zero times, the same behaviour does not occur: $ echo hello | awk -F ' *' -v OFS=, '{$1 = NF OFS $1} 1' 1,hello Anyone know why that is? I could not find anything in the gawk manual. Is FS="" just a special case? I'm most interested in understanding why the 2nd case does not split the record