Open main menu

CDOT Wiki β

Changes

Tutorial11: Sed & Awk Utilities

No change in size, 09:15, 6 March 2021
INVESTIGATION 1: USING THE SED UTILITY
# Issue the following linux pipeline command:<br><span style="color:blue;font-weight:bold;font-family:courier;">sed -n '/^The/ p' data.txt | tee sed-6.txt</span><br><br>What do you notice?<br><br>
# Issue the following linux pipeline command:<br><span style="color:blue;font-weight:bold;font-family:courier;">sed -n '/d$/ p' data.txt | tee sed-7.txt</span><br><br>What do you notice?<br><br>The '''sed''' utility can also be used as a filter to manipulate text that<br>was generated from linux commands.<br><br>[[Image:sed-5.png|thumb|right|400px|Using the sed command with '''pipeline''' commands.]]
# Issue the following linux pipeline command:<br><span style="color:blue;font-weight:bold;font-family:courier;">ls who | sed -n '/txt$^[a-m]/ p' | tee sed-8.txt| more</span><br><br>What did you notice?<br><br># Issue the following linux pipeline command:<br><span style="color:blue;font-weight:bold;font-family:courier;">who ls | sed -n '/^[a-m]txt$/ p' | tee sed-9.txt | more</span><br><br>What did you notice?<br><br>
# Issue the following to run a checking script:<br><span style="color:blue;font-weight:bold;font-family:courier;">bash /home/murray.saul/scripts/week11-check-1</span><br><br>If you encounter errors, make corrections and '''re-run''' the checking script until you<br>receive a congratulations message, then you can proceed.<br><br>
13,420
edits