I'm a student from indonesia and I want to create an script that deletes few lines from a file containing the following text:
zone "irf.com" {
type master;
file "db.irf.com";
allow-update { none; };
};
zone "friedrice.com" {
type master;
file "db.friedrice.com";
allow-update { none; };
};
zone "you.com" {
type master;
file "db.you.com";
allow-update { none; };
};
If i want to delete this:
zone "friedrice.com" {
type master;
file "db.friedrice.com";
allow-update { none; };
};
In the terminal I can run: sh you.txt friedrice
How is the syntax in shell programming??
All the text is in a file, let's say you.txt
I'm a newbie, so please help me
用这个:
sed -i -E -n '1h;1!H;${;g;s/zone "friedrice.com" {[^}]*};\n};//g;p;}' you.txt
sed -i '/^zone "friedrice.com"/,/^}/d' you.txt
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.