On 5/19/06, Luke Bakken <[EMAIL PROTECTED]> wrote:
On 5/19/06, David Romano <[EMAIL PROTECTED]> wrote:
> Hi Ankur,
> On 5/18/06, Ankur Gupta wrote:
> > perl -0777 -p -i -e 'print "abcdefgh\n"' *.ext
> > or
> > perl -0777 -p -i -e 's#^#abcdefgh\n#' *.ext
> > or
> > ???
> I did this:
> perl -p -i -e '$_ = ($ARGV ne $f && $f = $ARGV) ? "NEW FIRST LINE\n$_"
> : $_' *.ext
This'll (efficiently) add "FOO BAR BAZ BAT" to the beginning of INPUT.TXT
perl -MTie::File -e"tie @a, q(Tie::File),$ARGV[1] or die;unshift
@a,$ARGV[0];untie @a" "FOO BAR BAZ BAT" INPUT.TXT
Oh yeah! I forgot about Tie::File for some reason. :-)
David
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>