Feature #864
Using Sed to Add a Line To The Top of a File
Description
This is a simple method to add a line to the top of a file using sed. I've found it a simple alternative to editing a file for a trivial task.
- Use sed to add a line to the top of a file:
sed -i '1s/^/some\ basic\ text\n/' ~/example.txt
Resources¶
Updated by Daniel Curtis about 8 years ago
- Status changed from New to Resolved
- % Done changed from 0 to 100