Horje
How to split a string in bash Code Example
split string and create array bash
my_array=($(echo $string | tr "," "\n"))
split string in shell script
IN="bla@some.com;john@home.com"
arrIN=(${IN//;/ })
echo ${arrIN[1]}                  # Output: john@home.com
split bash string
IN="bla@some.com;john@home.com"
arrIN=(${IN//;/ })
split string and create array bash
IFS=', ' read -r -a array <<< "$string"
bash split variable by delimiter
IFS='|' read -r -a arrayName <<< "$variable"
How to split a string in bash
string="you got a friend in me"
IFS=' ' read -ra split <<< "$string"
echo "${split[*]}"
# Output: you got a friend in me
echo "${split[3]}"
# Output: friend
Source: how.wtf




Shell

Related
sed replace single line with multi line Code Example sed replace single line with multi line Code Example
ubuntu dpkg path Code Example ubuntu dpkg path Code Example
p4merge tool config Code Example p4merge tool config Code Example
How to install LAMP in Ubuntu 20.04? Code Example How to install LAMP in Ubuntu 20.04? Code Example
windows virtualenv pip numpy problem Code Example windows virtualenv pip numpy problem Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
13