This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: substrings in BASH-shells


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@pixstream.com   Waterloo, ON
(519) 884-4196 X2286  N2L 3L3
(519) 884-5949 (FAX)  http://www.pixstream.com



-----Original Message-----
From: fladerr@dk.ibm.com [mailto:fladerr@dk.ibm.com]
Sent: Wednesday, July 14, 1999 9:21 AM
To: cygwin@sourceware.cygnus.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@dk.ibm.com



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]