Unix & Linux Asked by sunwave121 on December 21, 2020
I have a config file with different values formatted like this:
[Global]
control_ip =
control_port =
control_socket = /run/tipper.sock
control_pass =
Now I just want to delete the lines that have no value after =
, of course without deleting the [Global]
section header.
sed '/=s*$/d' infile
or
sed '/=[[:blank:]]*$/d' infile
delete those lines that ends with =
followed by zero-or-more whitespaces.
Using awk
and preserve the empty lines:
awk -F'[=t ]' '$NF!="" || /^$/' infile
or
awk -F'=[[:blank:]]*' '$NF!="" || /^$/' infile
Correct answer by αғsнιη on December 21, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP