How to add a line to beginning of a file

Run the following command

This is a perl one liner that will append text to the beginning of a file.

PS It edits the file in place so please backup your file first before running.

perl -i -ple 'print q{PUTYOURTEXTHERE} if $. == 1; close ARGV if eof' myfilename


Popular posts from this blog

Vim vi how to reload a file your editing