Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

bash string before substring

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 #string #substring
ADD COMMENT
Topic
Name
1+8 =