Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

bash substring after character

TEXT="A very long text to read"
echo "${TEXT#*very }" #the string after the substring "very"
#output:
#long text to read

echo "${TEXT% to*}" #the string before the substring " to"
#output:
#A very long text
 
PREVIOUS NEXT
Tagged: #bash #substring #character
ADD COMMENT
Topic
Name
2+5 =