I need a script that can write text to an exsisting file starting on line 10. It is a blank line so it wont be a find / replace. Would like preferably it to be in bash, but anything that the terminal can interpret will work just fine.
RE-EDITED:
Sorry but still having a bit of a problem after I tested… Think it has something to do with what I want write to a file. Maybe this will make it easier..
3 c
4 d
5 e
6 f
7 g
8 h
9 i
10 zone "$zone" in {
12 type master;
13 file "/etc/bind/db.$zone";
14 };
15 k
16 l
17 m
Thanks in Advance,
Joe
Using
sed:Using
bash:Note that I’m not really sure if you mean insert at line 10 or at line 11, so double check the places I wrote
10above. You might want9for thesedcommand or11for thebashversion.In
perl, you can use the$NRvariable.And in
awk, it’sNR.But note that you can find and replace a blank line, e.g.