help-bash
[Top][All Lists]
Advanced

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

[Help-bash] How to split fields like awk with FS="\t"? (read)


From: Peng Yu
Subject: [Help-bash] How to split fields like awk with FS="\t"? (read)
Date: Thu, 14 May 2015 21:00:37 -0500

Hi, The following code shows that continuos TAB is treated as single
field separator as explained in "Word Splitting". But such a
definition is none intuitive. Sometime people what to treat each TAB
as a separator. Is there a way to do so in bash? Thanks.

IFS=$'\t' read -r -d $'\n' v x y z < <(printf "%s\t%s\t%s\t%s\n" a b '' c)
echo $v
echo $x
echo $y
echo $z

-- 
Regards,
Peng



reply via email to

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