Syntactic Confectionery Delight | |
PerlMonks |
Re: quick way to add a line to a file, if it's not already present (automating tweaking of /etc/ld.so.conf for installing Image::Magick)by mk. (Friar) |
on Nov 17, 2006 at 16:48 UTC ( [id://584753]=note: print w/replies, xml ) | Need Help?? |
one liner, as requested (: (it should add one line to the file in case it's not already there and that's all, right?!) perl -pi -e '$line = 1 if /pattern/; print "the line\n" if !$line&&eof' /etc/ld.so.conf
In Section
Seekers of Perl Wisdom
|
|