Nethence Newdoc Olddoc Lab Your IP BBDock  

Warning: those guides are mostly obsolete, please have a look at the new documentation.


regex and sed examples
Zero to one time low characters,
One or more time low characters,
Anything but a dash,
Remove UNIX comments,
  sed -e '
    /^ *#/d;
    /^  *#/d;
Note. with GNU sed you can use '[[:space:]] instead of the space and tab lines,
sed '/^[::space::]*#/d; /^$/d;' httpd.conf.dist > httpd.conf
Remove PHP comments,
sed '/\/\*/,/*\//d; /^\/\//d; /^$/d;'
To convert URLs to HTML links,
s|http: //\([a-zA-Z0-9.\,:\/?\&=~%+_#-]*\)|<a href=\"http: //\1\">\1</a>|g;
s|https: //\([a-zA-Z0-9.\,:\/?\&=~%+_#-]*\)|<a href=\"https: //\1\">\1</a>|g;
s|ftp: //\([a-zA-Z0-9.\,:\/?=\&~%+_#-]*\)|<a href=\"ftp: //\1\">\1</a>|g;
Print first line until "match" gets reached,
sed -n '1,/match/p'
print from "match" until the end of file gets reached,
sed -n '/match/,$p'
Print lines matching both match1 and match2 in the same line,
sed -ne /match1/{/match2/p;}
print the lines machine either match1 or match2,
grep -E 'match1|match2'

(obsolete, see the new doc)