English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System > Coders. Scripting

 
 
Thread Tools
Old 08 January 2019, 11:38   #1
solarmon
Registered User
 
solarmon's Avatar
 
Join Date: Dec 2018
Location: UK
Posts: 1,715
AmigaDOS command - CUT

Hi,

I would like to use the 'Cut' command as described at:

https://wiki.amigaos.net/wiki/AmigaO..._Reference#CUT

This is not an internal command, but I can't find command this in the C: directory of my ClassicWB-LITE setup. And I can't seem to find it on Aminet.

I've noticed that another command that is listed in this Wiki was also missing - 'Foreach', but I did manage to eventually find it on Aminet (http://aminet.net/package/util/cli/finkelshelltoo).

Is there a good repository of the AmigaDOS commands listed in wiki? Other than setting up the other ClassicWB versions and checking. But I found that these other versions - P96 and OS39 - did not have the 'Foreach' command in them either. I have not yet tried setting up ClassicWB FULL, ADV and ADVSP to check for these commands.

Cheers!
solarmon is offline  
Old 08 January 2019, 13:14   #2
solarmon
Registered User
 
solarmon's Avatar
 
Join Date: Dec 2018
Location: UK
Posts: 1,715
Hi,

I've got a workaround for now.

I wanted the CUT version as documented in wiki, which processes 'strings', but I found this CUT version on aminet which processes 'files':

http://aminet.net/package/util/cli/ksc_Cut

Since I was looking to use CUT on environment variables, and I am/can accessing these variables as 'files' in ENV: or RAM:, then it can be used in a similar way.

So this CUT command from aminet will do for now - although I had to still figure out how to get the length of the string/file and ended up using 'LIST' with the lformat 'L%' option (Prints the length of the file in bytes). (If there is a better way of doing this then please let me know)

I would still like to know a good resource for the AmigaDOS mentioned in the wiki.

Cheers!

Last edited by solarmon; 08 January 2019 at 14:49.
solarmon is offline  
Old 08 January 2019, 14:33   #3
daxb
Registered User
 
Join Date: Oct 2009
Location: Germany
Posts: 3,303
I think the problem is that the command are OS4 only? At least I guess so. For OS3 the AmigaDOS book is a good reference. Some cut down DOS command list/description can be found on Aminet.

A better way of string manipulation can be achieved with https://wiki.amigaos.net/wiki/AmigaOS_Manual:_ARexx A good offline ARexx reverence is ARexxGuide: http://aminet.net/search?query=arexxguide There you can find a section of string manipulation. It is much more powerful.
daxb is offline  
Old 08 January 2019, 14:47   #4
solarmon
Registered User
 
solarmon's Avatar
 
Join Date: Dec 2018
Location: UK
Posts: 1,715
Hi daxb,

Yes, on the main page, it does state that it is for AmigaOS 4.0 and beyond:

https://wiki.amigaos.net/wiki/Main_Page

I wish it stated this on their AmigaDOS command page itself too!

I'm looking to use these commands in a minimal startup-sequence and setup (as part of a WHDLoad launcher) - so I probably don't want at add too much to it? Do you know what are the minimum requirements to support ARexx scripting?

Cheers!
solarmon is offline  
Old 08 January 2019, 15:05   #5
daxb
Registered User
 
Join Date: Oct 2009
Location: Germany
Posts: 3,303
Requirements: More or less RexxMast running. See also https://wiki.amigaos.net/wiki/AmigaO...etting_Started In Libs should be rexxsyslib.library and rexxsupport.library. On an OS3 install they already exists.That's all. Of course you can use more libraries but not needed.
daxb is offline  
Old 08 January 2019, 16:35   #6
solarmon
Registered User
 
solarmon's Avatar
 
Join Date: Dec 2018
Location: UK
Posts: 1,715
Thanks for the pointers!

If I get really stuck on using standard AmigaOS commands (that might just be down to inexperience) then I'll take a look at Arexx.

Thanks for your help.

Cheers!
solarmon is offline  
Old 08 January 2019, 17:23   #7
jPV
Registered User
 
jPV's Avatar
 
Join Date: Feb 2008
Location: RNO
Posts: 1,006
You can use the Echo command on OS3.x setups for the same. At least on OS3.9, not that sure about 3.1 or so... but take a look at the documentation for example here (check the FIRST and LEN options to cut a substring).
jPV is offline  
Old 08 January 2019, 20:25   #8
solarmon
Registered User
 
solarmon's Avatar
 
Join Date: Dec 2018
Location: UK
Posts: 1,715
Yes, I eventually did realise that ECHO had these FIRST and LEN options. I still need to get the length of the string/file because I wanted to strip the last character from the string/file. (Is there a better way to get the length of a string/file than using List?)

But, using the internal ECHO command might be technically quicker than using an external command? So I might change my script to make use of ECHO instead. And it is one less command that I need to put in C:.

Cheers!
solarmon is offline  
Old 09 January 2019, 02:15   #9
AMIGASYSTEM
Registered User
 
AMIGASYSTEM's Avatar
 
Join Date: Aug 2014
Location: Brindisi (Italy)
Age: 70
Posts: 8,248
Quote:
Originally Posted by solarmon View Post
Hi,
I would like to use the 'Cut' command as described at:

This is not an internal command, but I can't find command this in the C: directory of my ClassicWB-LITE setup. And I can't seem to find it on Aminet.
If I can serve in C I have a command "cut", see screnshot

http://eab.abime.net/zone/Cut.zip

Last edited by AMIGASYSTEM; 13 January 2019 at 19:08.
AMIGASYSTEM is offline  
Old 09 January 2019, 10:16   #10
solarmon
Registered User
 
solarmon's Avatar
 
Join Date: Dec 2018
Location: UK
Posts: 1,715
@AMIGASYSTEM,

The CUT command was missing because this seems to only be on OS 4.0 and above.

Cheers!

Last edited by solarmon; 09 January 2019 at 13:09.
solarmon is offline  
Old 09 January 2019, 10:36   #11
AMIGASYSTEM
Registered User
 
AMIGASYSTEM's Avatar
 
Join Date: Aug 2014
Location: Brindisi (Italy)
Age: 70
Posts: 8,248
No, the screnshot system is OS 3.9 , successfully tested the cut command also with OS 2.x and 3.x
AMIGASYSTEM is offline  
Old 09 January 2019, 12:17   #12
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
But it's not part of a standard 3.9, 3.x or 2.x installation. The OP had already added a separate replacement version of the CUT command.
Daedalus is offline  
Old 09 January 2019, 12:51   #13
daxb
Registered User
 
Join Date: Oct 2009
Location: Germany
Posts: 3,303
Quote:
Originally Posted by solarmon View Post
I still need to get the length of the string/file because I wanted to strip the last character from the string/file. (Is there a better way to get the length of a string/file than using List?)
For example:
Code:
rx "say LENGHT('hello')"
rx "say LEFT('hello', 4)"
Code:
rx "say LEFT('hello', LENGTH('hello')-1)"
or
rx "str='hello'; say LEFT(str, LENGTH(str)-1)"
daxb is offline  
Old 09 January 2019, 13:44   #14
AMIGASYSTEM
Registered User
 
AMIGASYSTEM's Avatar
 
Join Date: Aug 2014
Location: Brindisi (Italy)
Age: 70
Posts: 8,248
Quote:
Originally Posted by Daedalus View Post
But it's not part of a standard 3.9, 3.x or 2.x installation. The OP had already added a separate replacement version of the CUT command.
I did not say it's part, i just said it works with 3.x or 2.x
AMIGASYSTEM is offline  
Old 09 January 2019, 14:33   #15
jPV
Registered User
 
jPV's Avatar
 
Join Date: Feb 2008
Location: RNO
Posts: 1,006
Quote:
Originally Posted by solarmon View Post
Yes, I eventually did realise that ECHO had these FIRST and LEN options. I still need to get the length of the string/file because I wanted to strip the last character from the string/file. (Is there a better way to get the length of a string/file than using List?)
Yea, I guess List is the way to go without 3rd party programs or ARexx. Not that elegant, but works at least.

Quote:
But, using the internal ECHO command might be technically quicker than using an external command? So I might change my script to make use of ECHO instead. And it is one less command that I need to put in C:.
Yes, it's quicker, if that matters. I also like to do things with the default stuff in the OS rather than with 3rd party programs.. especially if I'm going to share my scripts anywhere some day, better have as little dependencies as possible.
jPV is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cut down re-released games? PopoCop support.Games 10 03 September 2017 19:53
Hello (Director's cut:) Cobe Member Introductions 3 21 October 2014 12:40
AmigaDOS: call several commands in a single command line pintcat Coders. Scripting 6 09 February 2013 16:51
AmigaDOS echo command speechmark Retro1234 support.Other 3 01 May 2012 21:14
Would you cut into your A3000D case? tonyyeb support.Hardware 57 19 September 2008 18:43

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 08:46.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.23299 seconds with 15 queries