WebSphere Issues

29/05/2017

sed and awk commands

Filed under: Other — Ishtiaque @ 2:10 pm

1. sed:

  • sed -i s/string1/string2/g file.txt (Replace all occurrences of string1 with string2 and save the file)
  • sed s/pattern/replace_string/ file.txt (Replace first occurrence of string1 with string2)
  • sed 1,3s/pattern/replace_string/g file.txt (Replace all occurrences of string1 with string2 from lines 1 to 3)
  • sed -e ‘s/01/JAN/’ -e ‘s/02/FEB/’ -e ‘s/03/MAR/’ file.txt

2. awk:

  • awk ‘{ print $0 }’ /etc/passwd      (Prints entire file)
  • awk -F: ‘{ print $1 }’ /etc/passwd  (Prints first field of every line)
  • awk -F: ‘{ print $1 $6 }’ /etc/passwd (Prints first and sixth field of every line)

08/05/2017

Apache mod_rewrite

Filed under: Other — Ishtiaque @ 10:27 am
  • Apache mod_rewrite Introduction:

https://httpd.apache.org/docs/current/rewrite/intro.html

  • URL Rewriting Guide:

https://httpd.apache.org/docs/2.2/en/rewrite/

  • Apache Rewrite cheatsheet:

http://borkweb.com/story/apache-rewrite-cheatsheet

Blog at WordPress.com.