mindia
mindia

Reputation: 7759

BackSpace in .bash file

I work with .bash script and I try to remove lines from file

 sed -e s/^DNS1.*/''/g -i $DNS_IP_CONFIG_FILE

but remains blank lines.I need baskspace in this code

Upvotes: 0

Views: 173

Answers (3)

jaypal singh
jaypal singh

Reputation: 77185

sed -i -ne '/^DNS1.*/!p' $DNS_IP_CONFIG_FILE

Upvotes: 1

Amit
Amit

Reputation: 20516

sed -i '/^DNS1.*/d' $DNS_IP_CONFIG_FILE

Upvotes: 5

nosid
nosid

Reputation: 50144

sed -i -e '/^DNS1/d' "$DNS_IP_CONFIG_FILE"

Upvotes: 5

Related Questions