Skip to content

Instantly share code, notes, and snippets.

@stefanbirkner
Created June 22, 2011 14:41
Show Gist options
  • Save stefanbirkner/1040236 to your computer and use it in GitHub Desktop.
Save stefanbirkner/1040236 to your computer and use it in GitHub Desktop.
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