1. Taking your sed(1) skills beyond the easily swallowed 's/x/y/' porridge
- 1.1 Introduction
- 1.2 Progressively cooking a nice 'al dente' 'sed' command file
- 1.3 Modifying the '/etc/ttys' file
1.1 Introduction
The DESCRIPTION from the
sed(1) man page:
Code:
The sed utility reads the specified files, or the standard input if no
files are specified, modifying the input as specified by a list of com-
mands. The input is then written to the standard output.
Please note that
'sed' does not overwrite or change files. Some
'sed' versions, e.g. the GNU sed, allow you to overwrite the original.
A simple example. If we have a file with the following contents:
Code:
Dear Jennifer,
I miss your beautiful brown eyes.
....
We can adapt this letter for our new love Sally, who has deep blue eyes.
Code:
$ sed -e 's/Jennifer/Sally/' -e 's/brown/blue/' letter.jennifer
Dear Sally,
I miss your beautiful blue eyes.
....
As stated
sed(1) has modified the input and written it to standard output. For mailing this letter we have to redirect the outcome to file with something like
$ sed -e 's/Jennifer/Sally/' -e 's/brown/blue/' letter.jennifer >letter.sally