Answers for "bash split variable by delimiter"


split bash string

IN="[email protected];[email protected]"
arrIN=(${IN//;/ })
Posted by: Guest on April-29-2020

bash split string into variables

# separator is space
VAR="inforge srl bergamo"
read -r ONE TWO THREE <<< "${VAR}"
echo ${ONE}
echo ${TWO}
echo ${THREE}

# separator is comma
IFS="," read -r ONE TWO THREE <<< "${VAR}"
echo "${ONE} ${TWO} ${THREE}"
Posted by: Guest on September-24-2020

bash split variable by delimiter

IFS='|' read -r -a arrayName <<< "$variable"
Posted by: Guest on May-04-2020

Code answers related to "bash split variable by delimiter"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language