Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

substring in shell script

STR="birthday-091216-pics"
SUBSTR=$(echo $STR | cut -d'-' -f 2)
echo $SUBSTR
Comment

how to print substring in bash script

INPUT='someletters_12345_moreleters.ext'
SUBSTRING=$(echo $INPUT| cut -d'_' -f 2)
echo $SUBSTRING
Comment

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"
Comment

PREVIOUS NEXT
Code Example
Shell :: install 7z commadn line windows 
Shell :: sh is null if 
Shell :: bitbucket how to undo commit 
Shell :: shell script while loop example 
Shell :: pip install without dependencies 
Shell :: bash copy file to directory 
Shell :: env npm 
Shell :: httpd ssl 
Shell :: how to install anything on kali linux 
Shell :: read last line file bash 
Shell :: sudo add permissions to user 
Shell :: get current user debian 
Shell :: zsh: command not found: npm 
Shell :: files tar.gz 
Shell :: committed to wrong branch 
Shell :: how to install winetricks 
Shell :: install node on ubuntu 
Shell :: linux install nvm 
Shell :: linux link file 
Shell :: install laravel globally mac 
Shell :: github get parent branch 
Shell :: git branch delete all local branches 
Shell :: download torrent magnet on linux 
Shell :: rm -rf 
Shell :: git rm cached 
Shell :: install sweetlalert angular 
Shell :: command to check pip3 version on linux 
Shell :: cypress installation 
Shell :: sudo: lsof: command not found 
Shell :: home directory of wsl 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =