Skip to content

Instantly share code, notes, and snippets.

@stefanbirkner
Created June 22, 2011 14:41
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Add a new line at the beginning of a text file
#!/bin/sh
#adds the line 'the new first line' at the beginning of file 'filename'
sed -i '1 i\the new first line' filename
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment