8.4 UNIX-compatible commands
This section explains how to use each of the UNIX-compatible commands. The following are general notes.
- Regular expressions supported in UNIX-compatible commands
-
Basic regular expressions and extended regular expressions are both supported. Basic regular expressions can be used in the following commands:
-
expr
-
grep (when the -G option is specified)
-
sed (when the -E option is not specified)
Extended regular expressions can be used in the following commands:
-
awk
-
egrep
-
grep (when the -E option is specified)
-
sed (when the -E option is specified)
Both types of regular expression support the use of metacharacters. The following table describes the metacharacters that can be used.
Table 8‒5: Differences in the metacharacters that can be used in regular expressions Metacharacter
Meaning
Basic regular expressions
Extended regular expressions
*
Zero or more repetitions
Y
Y
\+
One or more repetitions
Y
N
+
One or more repetitions
N
Y
.
One character
Y
Y
\?
The preceding regular expression
Y
N
?
The preceding regular expression
N
Y
^
Beginning of the line
Y
Y
$
End of the line
Y
Y
\|
Or
Y
N
|
Or
N
Y
[char-list]
Range specification
Y
Y
\(regexp\)
Grouping
Y
N
(regexp)
Grouping
N
Y
\{n, m\}
Repeats at least n times but no more than m times
Y
N
{n, m}
Repeats at least n times but no more than m times
N
Y
\{n\}
n times
Y
N
{n}
n times
N
Y
\{n, \}
n or more times
Y
N
{n, }
n or more times
N
Y
-
- About the command usage examples
-
-
In the usage examples provided in the remainder of this chapter, the UNIX-compatible commands are executed on Windows, with a few exceptions.
-
The path to the directory where the commands are installed is assumed to have been set in the ADSH_OSCMD_DIR environment variable.
-
- Organization of this section
-
-
cut command (outputs selected parts of lines to the standard output)
-
dirname command (retrieves character strings for directory path names from path names)
-
stat command (outputs the statuses of files and directories to the standard output)
-
touch command (changes a file's last access date and time or modification date and time)
-
uname command (displays information about the OS or hardware)
-
wc command (counts the number of bytes, lines, characters, and words in files)