Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 1st, 2012  |  syntax: None  |  size: 1.46 KB  |  hits: 8  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How to match 2 lines of html code in a index.html file using egrep
  2. <link type="text/css" rel="stylesheet" href="https://test.mydomain.com/store.css">
  3.        
  4. <script type="text/javascript" language="javascript" src="https://test.mydomain.com/store/gwt.nocache.js">
  5.        
  6. if grep -F -i -n '<link type="text/css" rel="stylesheet" href="https://test.mydomain.com/store.css">' tmp.html > out.txt; then cat out.txt # IT WORKS.
  7.        
  8. egrep '(pattern1|pattern2)'
  9.        
  10. if egrep -e -i -c '(<link type="text/css" rel="stylesheet" href="https://test.mydomain.com/gwtstore/store.css">|<link type="text/css" rel="stylesheet" href="https://test.mydomain.com/store/gwt.nocache.js">)' tmp.html > out.txt; then cat out.txt
  11.        
  12. fgrep -e 'firts_pattern' -e 'second_pattern'
  13.        
  14. sed -i 's/<link type="text/css" rel="stylesheet" href="https://test.mydomain.com/store.css">/<REPLACE PATTERN 1>/g;s/<script type="text/javascript" language="javascript" src="https://test.mydomain.com/store/gwt.nocache.js">/<REPLACE PATTERN 2>/g' /yourfile
  15.        
  16. sed -i '' 's/<link type="text/css" rel="stylesheet" href="https://test.mydomain.com/store.css">/<REPLACE PATTERN 1>/g;s/<script type="text/javascript" language="javascript" src="https://test.mydomain.com/store/gwt.nocache.js">/<REPLACE PATTERN 2>/g' /yourfile
  17.        
  18. awk '/<link type="text/css" rel="stylesheet" href="https://test.mydomain.com/store.css">/; /<script type="text/javascript" language="javascript" src="https://test.mydomain.com/store/gwt.nocache.js">/' /yourfile