sed extract text between markers

How do I extract config values from between BEGIN and END markers?

Try: sed -n '/BEGIN CERTIFICATE/,/END CERTIFICATE/p' /etc/ssl/certs/server.crt Info: sed -n suppresses automatic printing. The pattern '/START/,/END/p' prints all lines between two matching delimiters (inclusive). Examples: $ sed -n '/^\[database\]/,/^$/p' config.ini  # Extract section until empty line $ awk '/BEGIN/,/END/' file.txt  # Equivalent using awk $ sed -n '/ERROR/,+5p' logfile  # Print […]

Read More