Chapter 6. Manipulating Files

Chapter contents

  • Counting files and file contents

  • Viewing file beginnings

  • Viewing file endings

  • Finding text

  • Using regular expressions

  • Making global changes

  • Changing files

  • Comparing files

  • Finding differences in files (two methods)

  • Sorting files

  • Redirecting files to two locations

As you learned back in Chapter 4, you can fairly easily work with text by opening up an editor and making the changes you want. But you can do more than just copy, paste, cut, or move text in files. As we'll discuss in this chapter, you can manipulate entire files and look at specific parts of them, get information about the files, find text in files, compare files, and sort files. All kinds of neat stuff!

In this chapter, we'll use a lot of flags ...

Get Unix: Visual QuickStart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.