Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

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 by how.wtf #
 
PREVIOUS NEXT
Tagged: #How #split #string #bash
ADD COMMENT
Topic
Name
5+2 =