From 7ffcd5a7f3c3c4e25b695e62a4270b2b8dc2969c Mon Sep 17 00:00:00 2001 From: Marc Date: Mon, 3 Oct 2022 17:47:56 +0200 Subject: [PATCH 1/2] completed exercises --- solutions.ipynb | 63 +++++++++++++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 26 deletions(-) diff --git a/solutions.ipynb b/solutions.ipynb index 10ae56f..88b96f9 100644 --- a/solutions.ipynb +++ b/solutions.ipynb @@ -22,7 +22,7 @@ "cell_type": "raw", "metadata": {}, "source": [ - "The command:" + "The command: echo \"Hello World\"" ] }, { @@ -38,7 +38,7 @@ "cell_type": "raw", "metadata": {}, "source": [ - "The command:" + "The command: mkdir new_dir" ] }, { @@ -54,7 +54,7 @@ "cell_type": "raw", "metadata": {}, "source": [ - "The command:" + "The command: rm -r new_dir/" ] }, { @@ -70,7 +70,7 @@ "cell_type": "raw", "metadata": {}, "source": [ - "The command:" + "The command: echo \"Hello World\"" ] }, { @@ -86,7 +86,7 @@ "cell_type": "raw", "metadata": {}, "source": [ - "The command:" + "The command: mkdir new_dir" ] }, { @@ -102,7 +102,7 @@ "cell_type": "raw", "metadata": {}, "source": [ - "The command:" + "The command: rm -r new_dir/" ] }, { @@ -118,7 +118,9 @@ "cell_type": "raw", "metadata": {}, "source": [ - "The command:" + "The command: \n", + "mkdir lorem-copy\n", + "cp lorem/sed.txt lorem-copy" ] }, { @@ -134,7 +136,16 @@ "cell_type": "raw", "metadata": {}, "source": [ - "The command:" + "The command: cp lorem/at.txt lorem-copy ; cp lorem/lorem.txt lorem-copy" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "Other option: cp lorem/{at.txt,lorem.txt} lorem-copy" ] }, { @@ -150,7 +161,7 @@ "cell_type": "raw", "metadata": {}, "source": [ - "The command:" + "The command: cat lorem/sed.txt" ] }, { @@ -166,7 +177,7 @@ "cell_type": "raw", "metadata": {}, "source": [ - "The command:" + "The command: cat lorem/{at.txt,lorem.txt}" ] }, { @@ -182,7 +193,7 @@ "cell_type": "raw", "metadata": {}, "source": [ - "The command:" + "The command: head --lines=3 lorem-copy/sed.txt" ] }, { @@ -198,7 +209,7 @@ "cell_type": "raw", "metadata": {}, "source": [ - "The command:" + "The command: tail --lines=3 lorem-copy/sed.txt" ] }, { @@ -214,7 +225,7 @@ "cell_type": "raw", "metadata": {}, "source": [ - "The command:" + "The command: echo \"Homo homini lupus\" >> lorem-copy/sed.txt" ] }, { @@ -230,7 +241,7 @@ "cell_type": "raw", "metadata": {}, "source": [ - "The command:" + "The command: tail --lines=3 lorem-copy/sed.txt" ] }, { @@ -246,7 +257,7 @@ "cell_type": "raw", "metadata": {}, "source": [ - "The command:" + "The command: sed -i -e 's/et/ET/g' lorem-copy/at.txt" ] }, { @@ -262,7 +273,7 @@ "cell_type": "raw", "metadata": {}, "source": [ - "The command:" + "The command: whoami" ] }, { @@ -278,7 +289,7 @@ "cell_type": "raw", "metadata": {}, "source": [ - "The command:" + "The command: pwd" ] }, { @@ -294,7 +305,7 @@ "cell_type": "raw", "metadata": {}, "source": [ - "The command:" + "The command: cd lorem ; ls *.txt" ] }, { @@ -310,7 +321,7 @@ "cell_type": "raw", "metadata": {}, "source": [ - "The command:" + "The command: wc -l lorem/sed.txt" ] }, { @@ -326,7 +337,7 @@ "cell_type": "raw", "metadata": {}, "source": [ - "The command:" + "The command: find . -name \"lorem*\" -type f | wc -l" ] }, { @@ -342,7 +353,7 @@ "cell_type": "raw", "metadata": {}, "source": [ - "The command:" + "The command: grep --color=always \"et\" lorem/at.txt" ] }, { @@ -358,7 +369,7 @@ "cell_type": "raw", "metadata": {}, "source": [ - "The command:" + "The command: grep \"et*\" lorem/at.txt | wc -l" ] }, { @@ -397,7 +408,7 @@ "cell_type": "raw", "metadata": {}, "source": [ - "The command:" + "The command: name=marc" ] }, { @@ -413,7 +424,7 @@ "cell_type": "raw", "metadata": {}, "source": [ - "The command:" + "The command: echo $name" ] }, { @@ -429,7 +440,7 @@ "cell_type": "raw", "metadata": {}, "source": [ - "The command:" + "The command: mkdir $name" ] }, { @@ -445,7 +456,7 @@ "cell_type": "raw", "metadata": {}, "source": [ - "The command:" + "The command: rm -ls marc" ] }, { From b92d10e3e4ea415bcdd5962ad70bdc9249385491 Mon Sep 17 00:00:00 2001 From: Marc Date: Mon, 3 Oct 2022 23:11:10 +0200 Subject: [PATCH 2/2] first update of exercises --- solutions.ipynb | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/solutions.ipynb b/solutions.ipynb index 88b96f9..df898ad 100644 --- a/solutions.ipynb +++ b/solutions.ipynb @@ -369,7 +369,7 @@ "cell_type": "raw", "metadata": {}, "source": [ - "The command: grep \"et*\" lorem/at.txt | wc -l" + "The command: grep -o \"et\" lorem/at.txt | wc -l" ] }, { @@ -385,7 +385,24 @@ "cell_type": "raw", "metadata": {}, "source": [ - "The command:" + "The command: grep -roh -i \"et\" lorem-copy/ | wc -l" + ] + }, + { + "cell_type": "raw", + "metadata": {}, + "source": [ + "The command: grep -roh \"et\" lorem-copy/ | wc -l" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# The first one considers the capitalized ET in at.txt (-i ignores case)\n", + "# The second one only considers \"et\"" ] }, { @@ -408,7 +425,7 @@ "cell_type": "raw", "metadata": {}, "source": [ - "The command: name=marc" + "The command: name=\"marc\"" ] }, { @@ -456,7 +473,7 @@ "cell_type": "raw", "metadata": {}, "source": [ - "The command: rm -ls marc" + "The command: rm -r marc/" ] }, {