hi guys,
actually shell redirection is what i have been doing in the past (without perl), but i wanted to have a one-liner that can be called externally. The basic idea is to automate editing a file with different access permissions than the user, via sudo, and not have to chown the file first to the user..
i can already edit a file if there is content in the file, without using shell redirection, using a perl one-liner like this:
perl -i -ne 'print unless 1 .. 100; print q{testing} if$.==1' somefile
of course this doesn't truncate the file, which is what i was interested in attempting.. | [reply] [Watch: Dir/Any] [d/l] |
Hi Kanji, i didn't see your reply when i was posting mine..
thanks! that's perfect..
thanks to everyone for their help.
| [reply] [Watch: Dir/Any] |