Project

General

Profile

Feature #864

Using Sed to Add a Line To The Top of a File

Added by Daniel Curtis about 8 years ago. Updated about 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Shell Scripts
Target version:
Start date:
10/25/2016
Due date:
% Done:

100%

Estimated time:
0.10 h
Spent time:

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

#1

Updated by Daniel Curtis about 8 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100
#2

Updated by Daniel Curtis about 8 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF