Wow. I didn't know bash had arrays. Kool. :-)
jipe wrote:
On Sat, 11 Jan 2003 17:56:16 -0800
Jim C <[EMAIL PROTECTED]> wrote:
I have a list of positive integers of which I only want the first one.
They are of arbitrary size. How can I cut the rest of them off?
I've been trying to write a regular expression for this using sed or awk.
bash you said, so use only bash.
array=($(your_command_to_create_the list_of_intergers))
echo ${array[0]}
this displays the 1rst integer from your list.
echo ${#array[*]} displays the number of integers
echo ${array[$((${#array[*]}-1))]} displays the last integer
etc...
maybe you'll have to set IFS. depends of the separator.
bye
jipe
------------------------------------------------------------------------
Want to buy your Pack or Services from MandrakeSoft?
Go to http://www.mandrakestore.com
Want to buy your Pack or Services from MandrakeSoft?
Go to http://www.mandrakestore.com