To save a message into a file, use the following command form at the mailx prompt.
s number filename |
where number is the number of the message to be saved and filename is the file where you want to save the message. For example, to save message 3 into a file called ~/notes/finance, you would type:
& s 3 ~/notes/finance |
Remember that in a path name, the ~ represents your home directory.
You can also save several messages at once to the same file. For example, to save messages 3, 5, 6, 7, and 8 to ~/notes/finance, type the following command.
& s 3 5-8 ~/notes/finance |
If the file you specify does not exist, mailx creates it. If the file does exist, mailx appends the message you are saving to the end of the file.
Saving a file removes it from your mailbox. mailx displays an asterisk (*) next to the header of any message than has been saved.
To leave the message in your mailbox while appending it to another file, use the copy command, as follows:
& c 3 ~/notes/finance |