To remove both commented lines and empty lines from a HOCON file, combine `grep` and `sed` commands like so:
grep -vE '^\s*(#|$)' <filename> | sed '/^\s*$/d'
- `grep -vE '^\s*(#|$)' <filename>`: This `grep` command filters out lines that are entirely empty or start with optional whitespace (`\s*`) followed by a `#` character (indicating a comment) or are entirely empty (`$`).
- `sed '/^\s*$/d'`: This `sed` command removes lines that are entirely empty. `/^\s*$/` matches lines that contain only optional whitespace characters followed by the end of the line (`$`). The `d` command then deletes these lines.
Replace `<filename>` with the name of your HOCON file.
***