Commit 61ad09d2 authored by jkvis's avatar jkvis

Added assignments for text processing and processes and job control

parent ae5fca53
\documentclass{article}
\frenchspacing
\setlength{\parindent}{0pt}
\pagestyle{empty}
\let\tempitemize=\itemize
\renewcommand\itemize{
\vspace{-5pt}
\tempitemize
\setlength{\itemsep}{0pt}
}
\let\tempenditemize=\enditemize
\renewcommand\enditemize{
\tempenditemize
}
\title{Processes and Job Control}
\date{}
\begin{document}
\maketitle
\thispagestyle{empty}
\begin{enumerate}
\item Start the \texttt{nano} from the terminal and type a few lines.
Suspend the \texttt{nano} process using \texttt{Ctrl+Z}.
\item Use \texttt{ps} (with some options) to get the \texttt{PID} and
\texttt{PPID} of the \texttt{nano} process. Can you relate the
\texttt{nano} process to one of the other processes?
\item Use \texttt{jobs} to find your \texttt{nano} process. What is its
running status?
\item Kill the \texttt{nano} process using its \texttt{PID}. What is its
running status now in the job list?
\item Start a new \texttt{nano} process in the background.
\item How can we activate this newly created process?
\item Execute the command: \texttt{\$ yes > /dev/null \&}. What does it
do?
\item Inspect the running \texttt{yes} processes interactively using
\texttt{top}. How much resources (CPU, memory) does it consume? Don't
forget to stop the process in the end.
\item Execute \texttt{\$ yes | grep 'y' > /dev/null \&}. Inspect with
\texttt{top}. What could go wrong in a shared multi-user environment?
If we terminate the \texttt{yes} process, what happens to the
\texttt{grep} process?
\item Try to set up an environment where you can simultaneously 1) run
a script 2) edit a script 3) monitor its progress. (Tip: use one of
yesterdays assignments).
\item Some commands can take a long time. Time the command:
\texttt{\$ du -h /}. Why do the times not add up?
\item Time the command: \texttt{\$ du -h / > /dev/null}. Why is there
still output? Explain the time difference to the previous run.
\end{enumerate}
\end{document}
......@@ -292,7 +292,6 @@ We can use the job number to select which job we want to bring to foreground: \\
We can also terminate a job using its job number: \\
\texttt{\$ kill -9 \%2}
\end{frame}
\end{document}
\documentclass{article}
\frenchspacing
\setlength{\parindent}{0pt}
\pagestyle{empty}
\let\tempitemize=\itemize
\renewcommand\itemize{
\vspace{-5pt}
\tempitemize
\setlength{\itemsep}{0pt}
}
\let\tempenditemize=\enditemize
\renewcommand\enditemize{
\tempenditemize
}
\title{Text Processing}
\date{}
\begin{document}
\maketitle
\thispagestyle{empty}
\section{Inspect the ``middle'' of a file}\label{sec:middle}
Write a small script that, given two parameters $n, m$, prints
$m$ lines of a file starting at the $n$-th line. \\
What about invalid parameters?
\section{Transpose a data file}\label{sec:transpose}
The file \texttt{capitals.txt} is \emph{transposed}, i.e., the rows
should be columns and vice versa. This file should be restored to its
correct character separated values file consisting of three columns of
data; \texttt{County}, \texttt{City}, \texttt{Continent}. Use as
delimiter the \texttt{tab}~character. \\
\begin{itemize}
\item Tip 1: reuse the script from Assignment~\ref{sec:middle}.
\item Tip 2: if you used temporary files, don't forget to clean them up.
\end{itemize}
\section{Combining data files}\label{sec:combine}
In the file \texttt{cities.txt} the largest European cities are stored.
Not all capital cities are present there. Using the restored version
of the capital cities from Assignment~\ref{sec:transpose} create a file
listing all the cities and their countries without any duplicates. \\
What went wrong with Luxembourg?
\section{Aggregate the countries with large cities}
Generate a list containing the number of cities per country in
descending order using the output of Assignment~\ref{sec:combine}.
%./all_cities.sh | cut -f2 | sort | uniq -c | sort -k1gr
\section{Convert date formats}\label{sec:dates}
The dates in the file \texttt{eu.txt} are given as:
\texttt{Month day, year}, e.g., \texttt{March 25, 1957}. This format is
not very convenient for sorting. Write script that converts the date to
a more manageable format: \texttt{1957-03-25}. (Only the month January,
March and May occur). Note that the file \texttt{eu.txt} has a
\emph{header}.
\section{Order on dates}
Using the script from Assignment~\ref{sec:dates}, given a ordered list of
the EU countries on their join date (ascending). The country name should
be used to break ties.
\section{Finding similar currencies}
From the file \texttt{currencies.txt} select all the countries that use
a form of krone. And all forms of the pound.
\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