home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 25.8 Finding File Types Chapter 25
Showing What's in a File
Next: 25.10 Squash Extra Blank Lines
 

25.9 Adding and Deleting White Space

There are a lot of ways to change the amount of white space (space and tab characters) in a line:

  • Berkeley systems have cat -s (25.10 ) to replace sets of two or more blank lines with single blank lines. If you don't have cat -s or need something different, look at article 34.18 .

  • The crush (25.11 ) script removes all blank lines.

  • Use doublespace and triplespace (25.12 ) to double- and triple-space text.

  • The pushin (25.13 ) script replaces multiple white space characters with a single space. This can shorten long lines.

  • You can use sed to indent lines of text before printing (43.9 ) . The offset (35.7 ) shell script does that more easily.

  • For other jobs, utilities like awk (33.11 ) and sed (34.24 ) will probably do what you want. You have to understand how to program them before you use them.

- JP


Previous: 25.8 Finding File Types UNIX Power Tools Next: 25.10 Squash Extra Blank Lines
25.8 Finding File Types Book Index 25.10 Squash Extra Blank Lines

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