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)
The following table shows the characters that can be used in regular expressions. When you use the characters in this table in regular expressions, UNIX-compatible commands interpret them as metacharacters.
Table 8‒6: 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
- Legend:
Y: Can be used.
N: Cannot be used.
- 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
8.4.1 awk command (performs text processing and pattern matching)
8.4.6 cut command (outputs selected parts of lines to the standard output)
8.4.9 dirname command (retrieves character strings for directory path names from path names)
8.4.17 gzip command (compresses files or decompresses compressed files)
8.4.20 ln command (creates a link file for a file or directory)
8.4.21 ls command (lists the contents of files or directories)
8.4.32 stat command (outputs the statuses of files and directories to the standard output)
8.4.35 touch command (changes a file's last access date and time or modification date and time)
8.4.37 uname command (displays information about the OS or hardware)
8.4.38 uniq command (removes duplicated lines from a sorted file)
8.4.39 wc command (counts the number of bytes, lines, characters, and words in files)
8.4.40 which command (obtains the paths of external commands)