Commit fd4773f9 authored by  Joe  Rackham's avatar Joe Rackham
Browse files

Add grep section

parent 2f86c96e
\relax
\@writefile{toc}{\contentsline {section}{\numberline {1}General Tips}{1}}
\@writefile{toc}{\contentsline {section}{\numberline {2}Using the file-system}{1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.1}Inspecting a file}{1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.2}Navigating}{1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.3}Hidden Files}{1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.1}Navigating}{1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.2}Inspecting a particular file}{1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.3}Modifying a particular file}{2}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.4}Hidden Files}{2}}
\@writefile{toc}{\contentsline {section}{\numberline {3}Input \& Ouptut}{2}}
\@writefile{toc}{\contentsline {section}{\numberline {4}User \& Privledge}{2}}
\@writefile{toc}{\contentsline {section}{\numberline {5}Grep - Global Regular Expression Print}{2}}
\@writefile{toc}{\contentsline {subsection}{\numberline {5.1}Options}{2}}
\@writefile{toc}{\contentsline {subsection}{\numberline {5.2}Regex}{3}}
\@writefile{toc}{\contentsline {subsubsection}{\numberline {5.2.1}Special Characters}{3}}
\@writefile{toc}{\contentsline {subsubsection}{\numberline {5.2.2}Character Classes}{3}}
\@writefile{toc}{\contentsline {subsubsection}{\numberline {5.2.3}Line and Word Anchors}{3}}
This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/Debian) (preloaded format=pdflatex 2020.3.23) 27 MAR 2020 11:01
This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/Debian) (preloaded format=pdflatex 2020.3.23) 27 MAR 2020 12:04
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
......@@ -227,27 +227,32 @@ LaTeX Font Info: Font shape `OMS/cmr/m/n' in size <10> not available
(Font) Font shape `OMS/cmsy/m/n' tried instead on input line 15.
[1
{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] [2] (./main.aux) )
{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] [2]
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <7> on input line 134.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <5> on input line 134.
[3] (./main.aux) )
Here is how much of TeX's memory you used:
2103 strings out of 494923
30011 string characters out of 6180742
2109 strings out of 494923
30106 string characters out of 6180742
92576 words of memory out of 5000000
5404 multiletter control sequences out of 15000+600000
5410 multiletter control sequences out of 15000+600000
8063 words of font info for 29 fonts, out of 8000000 for 9000
14 hyphenation exceptions out of 8191
41i,6n,32p,271b,187s stack positions out of 5000i,500n,10000p,200000b,80000s
</usr/sh
are/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx10.pfb></usr/share/te
xlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.pfb></usr/share/texlive/
texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></usr/share/texlive/texmf-d
ist/fonts/type1/public/amsfonts/cm/cmr12.pfb></usr/share/texlive/texmf-dist/fon
ts/type1/public/amsfonts/cm/cmr17.pfb></usr/share/texlive/texmf-dist/fonts/type
1/public/amsfonts/cm/cmsy10.pfb></usr/share/texlive/texmf-dist/fonts/type1/publ
ic/amsfonts/cm/cmtt10.pfb>
Output written on main.pdf (2 pages, 81330 bytes).
</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/c
m/cmbx10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx
12.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi10.pfb
></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></usr/
share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr12.pfb></usr/share/t
exlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr17.pfb></usr/share/texlive/
texmf-dist/fonts/type1/public/amsfonts/cm/cmsy10.pfb></usr/share/texlive/texmf-
dist/fonts/type1/public/amsfonts/cm/cmtt10.pfb>
Output written on main.pdf (3 pages, 102206 bytes).
PDF statistics:
39 PDF objects out of 1000 (max. 8388607)
27 compressed objects within 1 object stream
46 PDF objects out of 1000 (max. 8388607)
32 compressed objects within 1 object stream
0 named destinations out of 1000 (max. 500000)
1 words of extra memory for PDF output out of 10000 (max. 10000000)
No preview for this file type
No preview for this file type
......@@ -26,16 +26,6 @@
\section{Using the file-system}
\subsection{Inspecting a file}
\begin{itemize}
\item \texttt{wc} returns the word count of a particular file
\begin{itemize}
\item The \texttt{-l} counts lines instead
\end{itemize}
\item \texttt{uniq} returns the number of unique lines in a file
\end{itemize}
\subsection{Navigating}
\begin{itemize}
\item \texttt{pwd} returns the current directory
......@@ -45,6 +35,7 @@
\item Pass multiple arguments to create multiple directories side-by-side
\item The \texttt{-p} parent option creates any missing parent directories in the path specified
\end{itemize}
\item \texttt{cp *source* *new\_name*} will create a copy of a file with a different name
\item \texttt{mv *source* *dest*} moves files between two locations
\begin{itemize}
\item Renaming is done by moving to another location in the same directory
......@@ -56,6 +47,21 @@
\end{itemize}
\end{itemize}
\subsection{Inspecting a particular file}
\begin{itemize}
\item \texttt{wc} returns the word count of a particular file
\begin{itemize}
\item The \texttt{-l} counts lines instead
\end{itemize}
\item \texttt{uniq} returns the number of unique lines in a file
\item \texttt{ls -l} details additional information about files including their r/w/x permissions
\end{itemize}
\subsection{Modifying a particular file}
\begin{itemize}
\item \texttt{touch *name*} will create a new file with the specified name
\end{itemize}
\subsection{Hidden Files}
\begin{itemize}
\item File and directories whose name starts with a . don't appear in the file explorer or when \texttt{ls} is used
......@@ -81,6 +87,55 @@
\item \texttt{sudo} runs a particular command as super-user
\end{itemize}
\section{Grep - Global Regular Expression Print}
\begin{itemize}
\item \texttt{grep} is used \texttt{grep *options* *regex* *file*} to search for occurances of paticular strings in files
\item \texttt{grep} returns the whole line where a match occurs
\end{itemize}
\subsection{Options}
\begin{itemize}
\item \texttt{-i} - Case insensitive
\item \texttt{-w} - Whole word search
\item \texttt{-r} - Recursively search through subdirectories
\item \texttt{-v} - Inverted (everywhere pattern doesn't appear)
\item \texttt{-l} - Files with matches
\item \texttt{-L} - Files without matches
\item \texttt{-H} - Prints file name with each match
\item \texttt{-q} - Quiet mode; no output but exit code indicates match
\end{itemize}
\subsection{Regex}
\subsubsection{Special Characters}
\begin{itemize}
\item . - Matches any single character
\item ? - Indicates the preceding item is optional
\item * - Indicates the preceding item will be matched 0 or more times
\item + - Indicates the preceding item will be matched 1 or more times
\item \{n, m\} - Matched atleast n times and no more than m
\item | - Alternation
\end{itemize}
\subsubsection{Character Classes}
\begin{itemize}
\item A character class is constructed \texttt{[*class*]}; a character matches the class if it matches any character in the class
\item Most simply; classes can be constructed with a list, \texttt{[aeiou]} or a range \texttt{[a-z]}
\item There are also some named classes constructed \texttt{[:*name*:]}
\begin{itemize}
\item upper and lower are the upper and lower-case alphabet; alpha is both
\item digit is the digits and alnum is the alpha numeric characters
\end{itemize}
\item Character classes constructed \texttt{[\^{} *name*]} are inverted
\end{itemize}
\subsubsection{Line and Word Anchors}
\begin{itemize}
\item \^{} - The following pattern should occur at the start of the line
\item \$ - The preceding pattern should occur at the start of the line
\item $/<$ - Anchors to the start of a word
\item $/>$ - Anchors to the end of a word
\end{itemize}
\end{document}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment