Changes

Jump to: navigation, search

Tutorial9: Regular Expressions

No change in size, 11:51, 13 March 2021
INVESTIGATION 3: OTHER COMMANDS USING REGULAR EXPRESSIONS
# We want to search for an option that can sort the file listing.<br>Type the following regular expression below and press '''ENTER''':<br><span style="color:blue;font-weight:bold;font-family:courier;">/sort</span><br><br>'''FYI:''' The '''grep''' and '''egrep''' Linux commands contain the regular expressions within quotes, but '''most''' other Linux commands specify regular expressions using<br>'''forward slashes''' (e.g. <span style="font-weight:bold;font-family:courier;">/regular expression</span> &nbsp; or &nbsp; <span style="font-weight:bold;font-family:courier;">/regular expression/</span>).<br><br>
# Scroll throughout the man pages for the ls command to view matches for the pattern "'''sort'''"<br>(You can press '''SPACE''' or key combination '''alt-b''' to move forward and backwards one screen respectively).<br><br>
# Press the letter <span style="color:blue;font-weight:bold;font-family:courier;">q</span> to '''exit''' the ''man'' pages for '''ls'''.<br><br>Let's use regular expressions with the '''moreless''' command.<br><br>
# Issue the following Linux command to download another data file called '''large-file.txt''':<br><span style="color:blue;font-weight:bold;font-family:courier;">wget <nowiki>https://ict.senecacollege.ca/~murray.saul/uli101/large-file.txt</nowiki></span><br><br>
# View the contents of the '''large-file.txt''' file using the '''more''' command and quickly view the contents of this file.<br><br>[[Image:other-re-2.png|thumb|right|300px|Entering '''/uli101''' in the '''less''' command can display all matches of "'''uli101'''" throughout the text file.]]
13,420
edits

Navigation menu