Skip to content

Commit 1d84a2f

Browse files
committed
Small updates of general text chapter.
1 parent d977b21 commit 1d84a2f

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

presentation/linux_bash_metacentrum_course.tex

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3069,6 +3069,7 @@ \subsection{Compressed text}
30693069
\item For files compressed by \texttt{lzma} or \texttt{lzma2} (\texttt{xz}, \texttt{lzma}) use \texttt{lzcat}, \texttt{lzdiff}, \texttt{lzegrep}, \texttt{lzfgrep}, \texttt{lzgrep}, \texttt{lzless}, \texttt{lzmore},~\ldots
30703070
\item Sometimes these variants are used automatically when user works with compressed file
30713071
\item \texttt{mc} can also do the job
3072+
\item These tools sometimes don't have all options of the \enquote{standard} applications
30723073
\end{itemize}
30733074
\end{frame}
30743075
@@ -3146,13 +3147,13 @@ \subsection{Comparisons}
31463147
\begin{itemize}
31473148
\item Saves difference between two files --- it can be later used as template to modify original file
31483149
\item Single patch file can contain changes from multiple files
3149-
\item Patch format from \texttt{diff -u} is common way how to send someone changes, improvements,~\ldots
3150+
\item Patch file from \texttt{diff -u} is common way how to send changes, improvements,~\ldots
31503151
\end{itemize}
31513152
\vfill
31523153
\begin{bashcode}
31533154
# Create the diff file
31543155
diff -u diff_test_file_1.txt diff_test_file_2.txt > difference.diff
3155-
# Apply the patch
3156+
# Apply the patch - xxx_file_1.txt is patched according to xxx_file_2.txt
31563157
patch < difference.diff # or
31573158
patch diff_test_file_1.txt difference.diff
31583159
\end{bashcode}
@@ -3299,6 +3300,9 @@ \subsection{Regular expressions}
32993300
\begin{itemize}
33003301
\item Implementation in \texttt{vim}, \texttt{sed}, \texttt{grep}, \texttt{awk} and \texttt{perl} and among various UNIX systems is almost same, but not identical --- can be confusing\ldots
33013302
\item \textbf{grep}, \textbf{sed} and \textbf{vim} \alert{require escaping} of \alert{\texttt{+}}, \alert{\texttt{?}}, \alert{\texttt{\{}}, \alert{\texttt{\}}}, \alert{\texttt{(}} and \alert{\texttt{)}} by backslash \alert{\texttt{\textbackslash}} (e.g. \texttt{\textbackslash +}, see also next slides)
3303+
\begin{itemize}
3304+
\item These characters have special meaning (see further) --- consider if you search for e.g. literal \texttt{+} or not (and then you can use it's special meaning)
3305+
\end{itemize}
33023306
\item \textbf{egrep} (extended version, launched as \texttt{grep -E \ldots} or \texttt{egrep \ldots}), \textbf{sed} with extended reg exp (\texttt{sed -r}) and \textbf{perl} \alert{do not} require escaping (simply just e.g. \texttt{+}, not \texttt{\textbackslash +})
33033307
\item Mastering regular expressions require practicing -- solve practical problems and see their power
33043308
\item Read \url{https://en.wikibooks.org/wiki/Regular_Expressions}, \url{https://www.grymoire.com/Unix/Regular.html}, \url{https://www.regular-expressions.info/}
@@ -3360,9 +3364,9 @@ \subsection{Regular expressions}
33603364
# Get quality of Illumina reads mapping to reference in genomic VCF
33613365
zcat arabidopsis.vcf.gz | grep -o "MQ=[[:digit:]]\+" | sed 's/^MQ=//'
33623366
# How many times there is a direct speech (text between "...")
3363-
grep -o '\"[[:upper:]][a-zA-Z0-9,\.\?\! ]\+\"' long_text.txt | wc -l
3367+
grep -o '"[[:upper:]][a-zA-Z0-9,\.\?\! ]\+"' long_text.txt | wc -l
33643368
# Add after dot on the end of the line by extra line break
3365-
sed 's/\.$/.\n/' long_text.txt
3369+
sed 's/\.$/.\n/' long_text.txt | less
33663370
# Add HTML paragraph tags (<p> and </p>)
33673371
sed -e 's/^/<p>/' -e 's/$/<\/p>/' long_text.txt | less
33683372
# Make first word of every paragraph bold in HTML (<strong>...</strong>)

0 commit comments

Comments
 (0)