
Untitled
By: a guest on
Aug 1st, 2012 | syntax:
None | size: 1.46 KB | hits: 8 | expires: Never
How to match 2 lines of html code in a index.html file using egrep
<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">
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.
egrep '(pattern1|pattern2)'
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
fgrep -e 'firts_pattern' -e 'second_pattern'
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
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
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