Project

General

Profile

Feature #864

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

Added by Daniel Curtis 11 months ago. Updated 10 months 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

History

#1 Updated by Daniel Curtis 11 months ago

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

#2 Updated by Daniel Curtis 10 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF