Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4109
  • Last Modified:

String substring?

Everyone:
Good afternoon.  If I wanted the first 4 characters of a string wouldn't I just:

#!/usr/bin/ksh
string=ABCDEJGHIJ
snip=${string:0:4}
echo $snip

I can't seem to make the snip variable contain what I want.  The only progress (see "Knowledge level on this subject :) ) I've been able to make is to set the Start parameter to a negative number which retruns the whole string.

As always many thanks for the help and encouragement.

RC
0
Just_RC
Asked:
Just_RC
  • 2
2 Solutions
 
TintinCommented:
I think it depends on your version of ksh as to whether this syntax is supported.

If you have run your script with bash, it will work.
0
 
Just_RCAuthor Commented:
Yes...indeed it works in bash.  I"m using M-11/16/88i.  Is there some sort of manual for this version, or any way to see how to do it in this envrionment?
0
 
ozoCommented:
man ksh
0
 
Just_RCAuthor Commented:
Thanks everyone...guess I'll skip it (even if its in the book (Rosenblatt & Robbins)  
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now