Unix Guru Universe wrote:
> INSERT A LINE
>
> If you want to insert a line
> at the top (or anywhere for that
> matter) of a file within a shell
> script, use the ed editor.
>
> EXAMPLE:
>
> string="hello"
> ed << EOF
> e any_file
> 1i
> ${string}
Mongers would:
perl -pi -e 'print "hello\n" unless $cnt++' any_file
Cheers,
Jay
Omaha Perl Mongers: http://omaha.pm.org