Read stdin delimited fails on empty field

2016-07-07 Thread Todd Merriman
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-redhat-linux-gnu' -DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -

Re: Read stdin delimited fails on empty field

2016-07-07 Thread Greg Wooledge
On Thu, Jul 07, 2016 at 03:01:31PM -0400, Todd Merriman wrote: > IFS=' ' # TAB > If any fields are empty, the data is read into the preceding field. > In other words, if in the example FLD3 is empty, FLD4 is read into > FLD3. If FLD2 and FLD3 are empty, FLD4 is r

Re: Read stdin delimited fails on empty field

2016-07-07 Thread Chet Ramey
On 7/7/16 3:01 PM, Todd Merriman wrote: > Bash Version: 4.2 > Patch Level: 46 > Release Status: release > > Description: > IFS=' ' # TAB > program_outputting_tab_delimited_fields | > while read -r FLD1 FLD2 FLD3 FLD4 > do > echo field1=$FLD1 >