Tuesday, April 5, 2011

sed - Read from a file or write into a file

  In this sed article, we will see how to read a file into a sed output, and also how to write a section of a file content to a different file.

  Let us assume we have 2 files, file1 and file2 with the following content:
$ cat file1
1apple
1banana
1mango
$ cat file2
2orange
2strawberry
  sed has 2 options for reading and writing: