Answers for "bash script find substring in string"

2

substring in shell script

STR="birthday-091216-pics"
SUBSTR=$(echo $STR | cut -d'-' -f 2)
echo $SUBSTR
Posted by: Guest on October-29-2020
0

substring in string shell

# You can do it in two ways
# 1) Let "grep" read on its standard input

echo "$line" | grep -o select

# 2) tell "grep" here is the string

grep select <<< "$line"
Posted by: Guest on April-20-2022

Code answers related to "bash script find substring in string"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language