delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/07/14/12:21:34

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-ID: <FCF810FE7713D311AADD006008A845162AF6FA@server.pixsci.com>
From: Mike Kuhl <mkuhl AT pixstream DOT com>
To: "'fladerr AT dk DOT ibm DOT com'" <fladerr AT dk DOT ibm DOT com>
Cc: cygwin AT sourceware DOT cygnus DOT com
Subject: RE: substrings in BASH-shells
Date: Wed, 14 Jul 1999 12:04:10 -0400
X-Mailer: Internet Mail Service (5.5.2232.9)

A snippet from the man page for bash:

       ${parameter:offset:length}
              Substring Expansion.  Expands to up to length char-
              acters of parameter, starting at offset.  If length
              is omitted, expands to the substring of  parameter,
              starting  at  the  character  specified  by offset.
              length and offset are arithmetic  expressions  (see
              ARITHMETIC EVALUATION below).  length must evaluate
              to a number greater than or equal to zero.  If off-
              set evaluates to a number less than zero, the value
              is used as an offset from the end of the  value  of
              parameter.  If parameter is @, the result is length
              positional  parameters  beginning  at  offset.   If
              parameter  is  an array name indexed by @ or *, the
              result is the length members of the array beginning
              with  ${parameter[offset]}.   Substring indexing is
              zero-based unless  the  positional  parameters  are
              used, in which case the indexing starts at 1.

I hope this helps.

Regards,

Mike.


---
Michael Kuhl          PixStream Incorporated
Sr. Test Designer     180 Columbia Street West
mkuhl AT pixstream DOT com   Waterloo, ON
(519) 884-4196 X2286  N2L 3L3
(519) 884-5949 (FAX)  http://www.pixstream.com



-----Original Message-----
From: fladerr AT dk DOT ibm DOT com [mailto:fladerr AT dk DOT ibm DOT com]
Sent: Wednesday, July 14, 1999 9:21 AM
To: cygwin AT sourceware DOT cygnus DOT com
Subject: substrings in BASH-shells




Hi !

How do I get a substring in BASH-shell. I've tried to use the utilities
"awk" and ${string,start,length}, but without luck !

Can you help me ?

Thanks in advance !


Med venlig hilsen/Best regards
Rune Flader

I/T Specialist, Business Solution Integration
IBM Denmark A/S, Sortemosevej 21, DK-3450 Allerød, Denmark
Phone +45 4523 9078,  Mobile +45 2346 6730,  Fax +45 4523 6809
Internet: fladerr AT dk DOT ibm DOT com



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019