Home Page The Club Computers News Links Glossary EYAWTK
Before Amiga Background ICS OCS ECS AGA ??? PPC
U-Boot SLB Linux Amiga OS Dual Boot Motherboards Peripherals Other
Initialisation Installation OS4 Updates About OS4 File Systems Networking Printing Other
Introduction File System Workbench Preferences Commands Error Msgs Miscellaneous

AmigaOS 4.0 - About OS4 - Commands

CUT AmigaDOS
Purpose: To cut some characters or words from a string.
Format: CUT <string> [CHAR <range> | WORD <range> [SEPARATOR <string>] ]
Template: STRING/A, C=CHAR/K, W=WORD/K, S=SEPARATOR/K
Path: C:CUT
CUT will extract any number of characters or words out of a string.

The extracted string is defined by a begin and an end position. Those values will be characters or words positions in the original string, i.e you may want to extract a string beginning with a character at position P1 and ending with a character at position P2. Behaviour is the same with words instead of characters.

Use the CHAR argument if you want to use begin/end values defined in characters. Use the WORD argument if you want to extract any number of words. Words are strings separated by the "space" character (default). Using the SEPARATOR argument, you can specify a string of any length to be used to split the original string in words.

The length of the string to extract will depend on the begin (P1) and the end (P2) position in the original string. This P1-P2 range to give after the CHAR (or WORD) argument follows the template:

P1[-P2] | [P1-]P2 | [P1]-P2 | P1-[P2]

The begin (P1) and end (P2) values are optional. This allows to extract only one character (or word) if you omit the end value. i.e with the argument like "CHAR P1" In order to extract several characters (or words), you need to specify a range with the "-" character like "CHAR P1-P2"

You can omit P1 if you want a string starting at the beginning of <string> with "CHAR -P2". And you do not need to know the string length because P2 can be omitted like "CHAR P1-". This will extract the string beginning with character at position P1 and ending at the end of the original <string>.

Example 1:

3.OS4:> CUT "Hello world" char 2
e
extract one character.

Example 2:

3.OS4:> CUT "Hello world" char 1-5
Hello
extract from character 1 to 5.

Example 3:

3.OS4:> CUT "Hello world" char -5
Hello
extract from character 1 to 5 without specifying the beginning position.

Example 4:

3.OS4:> CUT "Hello world" char 7-
world
extract from character 7 of the string till the end.

Example 5:

3.OS4:> CUT "Hello world" word 1 separator "ll"
He
extract one word (with another separator).


Return to Commands Selection

Disclaimer: Amiga Auckland have prepared the above information for the use of its members based on our experiences and as such is subject to revision at any time. Amiga Auckland cannot guarantee any of the information and cannot be held accountable for any issues that may result from using it.


Copyright 2006 Amiga Auckland Inc. All rights reserved.
Revised: February 9, 2006.