help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-bash] Is there a way to read the first empty field in a TSV input?


From: Peng Yu
Subject: [Help-bash] Is there a way to read the first empty field in a TSV input?
Date: Thu, 28 Sep 2017 10:56:14 -0500

Hi,

The following example shows that the variable "a" gets the value of
"x" which is the 2nd field of the input. I'd like "a" to always get
the first field even it may be empty. Is possible with bash?

~$ IFS=$'\t' read -r a b c <<< $'\t'x$'\t'y
~$ echo $a
x
~$ echo $b
y
~$ echo $c

-- 
Regards,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]