You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
\item Can not select column according to its name (Perl can do that)
2810
2810
\item For more information see manuals \url{https://www.gnu.org/software/gawk/manual/}, \url{https://en.wikibooks.org/wiki/An_Awk_Primer} and \url{https://www.grymoire.com/Unix/Awk.html}
2811
2811
\end{itemize}
2812
2812
\vfill
@@ -2881,7 +2881,7 @@ \subsection{Manipulations}
2881
2881
LC_ALL=C sort ... # To force use of English locale use
2882
2882
# Take into account only spaces and alphanumerical characters (ignore
2883
2883
# any other)
2884
-
sort -d textfile
2884
+
sort -d textfile # Only spaces and alphanumerical characters
2885
2885
sort -r textfile # Reverse order
2886
2886
sort -f textfile # Ignore character case (not case sensitive)
2887
2887
sort -m textfile1 textfile2 # Merge already sorted text files
@@ -2960,7 +2960,7 @@ \subsection{Manipulations}
2960
2960
# Search and replace ("s") all occurrences ("g") of "find" by "replace"
2961
2961
sed 's/find/replace/g' textfile
2962
2962
# Replace third occurrence of pattern on every line
2963
-
sed 's/pattern/Replace/3' # 's/.../.../' replace only third occurrence
2963
+
sed 's/pattern/Replace/3' # 's/.../.../3' replace only third occurrence
2964
2964
sed '1,7s/...' # To work only on particular line, place single number or
2965
2965
sed '5s/...' # range (e.g. 1,7) right before "s" ("$" for last line)
2966
2966
sed '1~2n;s/F/R/g' # Work on every second line, starting by line 1
@@ -2991,7 +2991,7 @@ \subsection{Manipulations}
2991
2991
# Replace size column (2nd numeric) by "size:TAB<file size>b"
2992
2992
# Second sed replaces any white spaces by single TAB
2993
2993
ls -l | sed 's/\([0-9]\+\)/size:\t\1b/2' | sed 's/[[:blank:]]\+/\t/g'
2994
-
head long_text.txt | sed '/^$/d' # Delete blank (empty) lines
2994
+
sed '/^$/d' long_text.txt | less # Delete blank (empty) lines
find . -name "*.sh" | sed 's/^\.\///;s/\.sh//' # Note chaining of patterns
3035
3035
find . -name "*.sh" # It searches also in subdirectories
3036
3036
\end{bashcode}
3037
3037
\begin{itemize}
@@ -3041,8 +3041,8 @@ \subsection{Manipulations}
3041
3041
3042
3042
\begin{frame}[fragile]{Joining}
3043
3043
\begin{itemize}
3044
-
\item Generally, most of tools work per-line, \texttt{paste} appends columns (slide~\ref{cutpaste})
3045
-
\itemJoin compares every matching lines (by default 1$^{st}$ field) and creates all combinations --- ensure to have sorted input files with unique text
3044
+
\item Generally, most of tools work per-line, \texttt{paste} appends columns (see also slide~\ref{cutpaste})
3045
+
\item\texttt{join} compares every matching lines (by default 1$^{st}$ field) and creates all combinations --- ensure to have sorted input files with unique text
3046
3046
\begin{itemize}
3047
3047
\item E.g. if 1$^{st}$ file contains \texttt{A~B} and \texttt{A~C} and 2$^{nd}$ file \texttt{A~D} and \texttt{A~E}, the result will be \texttt{A~B D}, \texttt{A~B E}, \texttt{A~C D} and \texttt{A~C E}
3048
3048
\end{itemize}
@@ -3241,7 +3241,7 @@ \subsection{Editors}
3241
3241
\begin{itemize}
3242
3242
\item\texttt{i} or \texttt{Insert} key to enter \textit{insert mode}, \texttt{:} to enter \textit{command mode}
3243
3243
\end{itemize}
3244
-
\item\textbf{Insert} --- in bottom left corner \enquote{{-}- \texttt{INSERT} -{-}} is displayed, the most familiar mode, normal typing etc., exit to normal mode by \texttt{ESC} key
3244
+
\item\textbf{Insert} --- in bottom left corner \enquote{\texttt{{-}- INSERT -{-}}} is displayed, the most familiar mode, normal typing etc., exit to normal mode by \texttt{ESC} key
3245
3245
\item\textbf{Command} --- in bottom left corner \texttt{:} is displayed, awaits commands, exit to normal mode by \texttt{Backspace} key (delete \enquote{\texttt{:}})
0 commit comments