fork(2) download
  1. #! /bin/bash
  2.  
  3. sep=$'\t'
  4. tempval=$'\n'
  5. while IFS= read -r line || [ -n "${line}" ]; do
  6. IFS="${sep}"
  7. line="${line}${tempval}"
  8. a=(${line//"${sep}"/"${tempval}${sep}"})
  9. a=("${a[@]%${tempval}}")
  10.  
  11. for ((i=0; i < ${#a[@]}; i++)) {
  12. printf '%s"%s"' "$([ "${i}" -gt 0 ] && printf ',')" "${a[i]}"
  13. }
  14. echo
  15. done
  16.  
Success #stdin #stdout 0.01s 4336KB
stdin
a	b	c
a	b
	b	c
		c

	b
	b	
		
a	b	c
stdout
"a","b","c"
"a","b"
"","b","c"
"","","c"

"","b"
"","b",""
"","",""
"a","b","c"