substring in Unix

Posted: February 17, 2016 in UNIX

Lets take a variable A=”Netezza is a Data Base”

let get the substring “Netezza” from the variable A.
echo ${A:0:7}
Result:-
Netezza

One can user variables for the start and length

Ex:-
B=0
C=7

echo ${A:B:C} #A is the actual string, B is the start and C is the length
Result:-
Netezza

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s