December 1999
Beginner
528 pages
11h 10m
English
When processing a file, sed allows you to read from another file and append the text from that file to the current file, placing it after the line with the pattern match. The format is:
address r filename
where ‘r’ lets sed know it’s going to read from another file source and ‘filename’ is the name of that file.
Let’s create a small file called sedex.txt. Here are the contents of the file:
$ pg sedex.txt
Boom boom went the music.
We are now going to append the file sedex.txt to the current working copy of our quote.txt file. We’ll put the contents of the file after the line where the pattern /company/ is matched, which is line 3. Please note that the filename we want to read stays enclosed by the single quotes. ...
Read now
Unlock full access