02.05.2013 Views

Basics of the MKS Toolkit - Mks.com

Basics of the MKS Toolkit - Mks.com

Basics of the MKS Toolkit - Mks.com

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Wild Card Characters<br />

Unlike standard Windows <strong>com</strong>mands, <strong>the</strong> <strong>MKS</strong> <strong>Toolkit</strong> lets you use<br />

<strong>the</strong> * character in directory and file names. For example,<br />

pg */*.c<br />

displays <strong>the</strong> contents <strong>of</strong> all files that have <strong>the</strong> .c extension, in<br />

directories under your current working directory.<br />

<strong>MKS</strong> <strong>Toolkit</strong> <strong>com</strong>mands also let you use ? in path names. The ?<br />

stands for any single character. For example,<br />

pg abc.?<br />

displays every file in <strong>the</strong> current working directory that begins with<br />

abc and has a one-character file name extension. This could display<br />

such files as<br />

abc.a abc.b abc.c abc.1 acb.2...<br />

The * and ? can be <strong>com</strong>bined:<br />

ls *.?<br />

displays <strong>the</strong> names <strong>of</strong> all files under <strong>the</strong> current working directory<br />

that have one-character file name extensions.<br />

Again, <strong>the</strong> ? can be used in directory names as well as file names. For<br />

example,<br />

ls ???/*<br />

shows all file names under every directory with a three character<br />

name.<br />

As you can see, you can refer to every file under a directory by using<br />

a single *. Standard Windows <strong>com</strong>mands such as dir would require<br />

*.*, since <strong>the</strong> * does not match <strong>the</strong> dot (.) character.<br />

Ano<strong>the</strong>r useful <strong>MKS</strong> <strong>Toolkit</strong> wild card construct consists <strong>of</strong> a set <strong>of</strong><br />

characters enclosed in square brackets. This construct stands for any<br />

<strong>of</strong> <strong>the</strong> characters in <strong>the</strong> set. For example,<br />

[bhm]at<br />

could stand for <strong>the</strong> names bat, hat, and mat. You can indicate a<br />

sequence <strong>of</strong> characters by specifying <strong>the</strong> first and last characters in<br />

<strong>the</strong> sequence, separated by a dash (-). For example,<br />

[a-z]<br />

stands for any single lowercase letter. A <strong>com</strong>mand like<br />

rm *.[a-z]<br />

removes every file with a suffix consisting <strong>of</strong> a single lowercase letter.<br />

<strong>Basics</strong> <strong>of</strong> <strong>the</strong> <strong>MKS</strong> <strong>Toolkit</strong> 11

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!