Sets the command to execute.
Namespace: CleanCode.RemoteCommandsAssembly: CleanCode.RemoteCommands (in CleanCode.RemoteCommands.dll) Version: 1.2.3.0 (1.2.03)
public void SetCmd(
string cmd,
string filterRE,
string outputFormat
)
Public Sub SetCmd ( _
cmd As String, _
filterRE As String, _
outputFormat As String _
)
public:
void SetCmd(
String^ cmd,
String^ filterRE,
String^ outputFormat
)
Along with the command string itself,
you specify a regular expression to use to filter the
output into chunks,
and a format specifier that references those chunks.
For example, the
df command returns output like this:
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/hda1 60604 33022 24453 58% /
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/hda1 60604 33022 24453 58% /
.*?\n\S+\s+(\d+)(?:\s+\d+){2}\s+(\S+)
.*?\n\S+\s+(\d+)(?:\s+\d+){2}\s+(\S+)
SetCmd("df",
@".*?\n\S+\s+(\d+)(?:\s+\d+){2}\s+(\S+)",
"{0} ({1})");
SetCmd("df",
@".*?\n\S+\s+(\d+)(?:\s+\d+){2}\s+(\S+)",
"{0} ({1})");
If you are interested in the capacity and the percentage used,
this regular expression
will select the 60604 and the 58% above.
To output that as "60604 (58%)" you need a format specifier of:
So putting these together the call would be: