Difference between revisions of "Content:Grep, Sed, and Awk"
Jump to navigation
Jump to search
(New page: More content about the commands will be coming soon. For now, here's the three "simple" commands Sam and Kay ran: <pre> grep -d recurse "header.html" . | grep -v barndoor | awk '{print $...) |
m |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
− | More content about the commands will be coming soon. For now, here's the three "simple" commands | + | More content about the commands will be coming soon. For now, here's the three "simple" commands we ran: |
<pre> | <pre> | ||
− | grep -d recurse "header.html" . | grep -v barndoor | awk '{print $1}' | cut -d: -f1 | + | grep -d recurse "header.html" . | grep -v barndoor | awk '{print $1}' | cut -d: -f1 >> ~/tmp/filesincludingheader |
for x in `cat ~/tmp/filesincludingheader`; do cat $x | sed "s;\.*/*header\.html;/includes/header.html;g" >> $x.newApr8; done | for x in `cat ~/tmp/filesincludingheader`; do cat $x | sed "s;\.*/*header\.html;/includes/header.html;g" >> $x.newApr8; done | ||
for x in `cat ~/tmp/filesincludingheader`; do mv $x.newApr8 $x; done | for x in `cat ~/tmp/filesincludingheader`; do mv $x.newApr8 $x; done | ||
</pre> | </pre> |
Latest revision as of 12:55, 15 April 2009
More content about the commands will be coming soon. For now, here's the three "simple" commands we ran:
grep -d recurse "header.html" . | grep -v barndoor | awk '{print $1}' | cut -d: -f1 >> ~/tmp/filesincludingheader for x in `cat ~/tmp/filesincludingheader`; do cat $x | sed "s;\.*/*header\.html;/includes/header.html;g" >> $x.newApr8; done for x in `cat ~/tmp/filesincludingheader`; do mv $x.newApr8 $x; done