- You can use the following command to print line number 50:
$ sed -n '50 p ' /etc/httpd/conf/httpd.conf
- You can use following command to change Apache default port 80 to 8080:
$ sed -i '0,/Listen [0-9]*/s//Listen 8080/' /etc/httpd/conf/httpd.conf
We search for Listen, where it defines the Apache default port, search for the number beside it, and change it to Listen 8080.