Substitution modifiers can be applied to any command, variable or history substitution. Also, any number in a row can be applied, as desired.
Operator
|
Meaning
|
|
---|---|---|
:n | nth word | |
:# | Count the number of words | |
:^ | Word number 1, counting from 0 | |
:$ | Last word | |
:% | Word matched by a !?str? history search | |
:n-m | nth through mth words | |
:-n | 0 through nth words | |
:n- | nth through next-to-last words | |
:n* | nth through last word | |
:* | 1 through last word | |
:q | Single-quote each word | |
:s/str1/str2/ | Substitute str2 for str1 and then reparse into words. Match failures are considered to be errors unless ignoreerrors == 2. | |
:S/str1/str2/ | Substitute str2 for str1 but leave it as a single string. Also, failure to match is not considered an error. | |
:& | Repeat last substitution | |
:g | Global editing: as a prefix character to any of the other editing operators, it means apply the edit operation everywhere it matches, not just the first occurrence. | |
:x | Treat each word as a string, break it up into words, then single-quote each word. | |
:p | Print the substitution but don't execute the statement. (Ignored except in history substitutions.) |
Pathname editing can be applied to any command, variable or history substitution. Also, any number of editing operations can be applied, one after the other, to a given substitution.
Operator
|
Name
|
Description
|
Result
|
|
---|---|---|---|---|
:h | head | Directory containing | x\y | |
:r | root | Path w/o .ext | x\y\z | |
:t | tail | Simple filename | z.c | |
:b | base | Filename w/o .ext | z | |
:e | ext | .ext w/o the "." | c | |
:f | fullpath | Fully-qualified name | d:\bob\x\y\z.c | |
:m | mixedpath | Mixed-case pathname | X\y\Z.c | |
:M | fullmixedpath | Mixed-case pathname | d:\Bob\X\y\Z.c | |
Windows NT and Windows 95 only: | ||||
:A | shortname | Short 8.3 filename | ||
:L | longname | Long filename |
The shortname function depends on support from the filesystem. Long filenames read over the network from an HPFS partition do not have shortnames, for example.
Previous Topic |
Next Topic
Hamilton C shell |
Free Updates |
Free Demo Software |
Win32 Training
Y2K |
Customer Testimonials |
On-line Hamilton C shell User Guide
Home |
Email |
Support |
Company Profile |
Distributors |
Links
Copyright © 1997-2001 by Hamilton Laboratories. All rights reserved.
You are visitor number
1027.
This page was last modified August 9, 2001.