UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 35.13 Other Conversions with dd Chapter 35
You Can't Quite Call This Editing
Next: 35.15 Cutting Columns with colrm
 

35.14 Cutting Columns or Fields with cut

cut+paste
System V includes a nifty command called cut that lets you select a list of columns or fields from one or more files. We've also included a public-domain version on the disc, for those of you whose systems do without.

You must specify either the -c option to cut by column or -f to cut by fields. (Fields are separated by tabs unless you specify a different field separator with -d. Use quotes (8.14) if you want a space or other special character as the delimiter.)

The column(s) or field(s) to cut must follow the option immediately, without any space. Use a comma between separate values and a hyphen to specify a range (e.g., 1-10, 15, 20, or 50-).

cut is incredibly handy. Here are some examples:

- TOR, DG


Previous: 35.13 Other Conversions with dd UNIX Power ToolsNext: 35.15 Cutting Columns with colrm
35.13 Other Conversions with dd Book Index35.15 Cutting Columns with colrm

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System