User Tools

Site Tools


sed

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
sed [2015/05/08 19:29] – created luke7858sed [2024/05/23 07:26] (current) – external edit 127.0.0.1
Line 13: Line 13:
 g represents every occurance g represents every occurance
 </sxh> </sxh>
 +\\
 +\\
 +=== remove multiple characters from line ===
 +Below removed [ and ]
 +<sxh bash>
 +sed 's/[][]//g'
 +</sxh>
 +below removes , 7 and l
 +<sxh bash>
 +sed 's/[,7l]//g'
 +</sxh>
 +\\
 +\\
 +=== remove anything before a character ===
 +<sxh bash>
 +sed 's/.*[/]//'
 +</sxh>
 +For example, if you are trying to get the log format for apache (centos):
 +<sxh bash>
 +grep ^ErrorLog /etc/httpd/conf/httpd.conf | awk '{print $2}' | sed 's/.*[/]//'
 +</sxh>
 +Returns
 +<sxh bash>
 +error_log
 +</sxh>
 +Sometimes format is error.log
sed.1431113372.txt.gz · Last modified: 2024/05/23 07:26 (external edit)

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki