Main index

Introducing UNIX and Linux


Overview
Using filters
      Collating sequence
      Character classes
Character-to-character transformation
Selecting lines by content
      Regular expressions
      Basic regular expressions
      Extended regular expressions
      Grep
Stream editor
      Sed addresses
Splitting a file according to context
Choosing between the three filters
More on Vi
Summary
Exercises

Answer to chapter 10 question 7

Use csplit to split the file at the position denoted by the BRE ^middle$ -- we have to 'anchor' the m and the e to be at the start and end of a line so that it does not split the file earlier if there is another word containing middle.

csplit /usr/dict/words '/^middle$/'


Copyright © 2002 Mike Joy, Stephen Jarvis and Michael Luck