Skip to content
Open

Edu #21

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added example.txt
Empty file.
155 changes: 104 additions & 51 deletions solutions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
]
},
{
"cell_type": "markdown",
"cell_type": "raw",
"metadata": {},
"source": [
"The command:"
"The command: echo \"Hello World\""
]
},
{
Expand All @@ -35,10 +35,10 @@
]
},
{
"cell_type": "markdown",
"cell_type": "raw",
"metadata": {},
"source": [
"The command:"
"The command: mkdir new_dir"
]
},
{
Expand All @@ -51,10 +51,10 @@
]
},
{
"cell_type": "markdown",
"cell_type": "raw",
"metadata": {},
"source": [
"The command:"
"The command: rm -r new_dir"
]
},
{
Expand All @@ -67,10 +67,12 @@
]
},
{
"cell_type": "markdown",
"cell_type": "raw",
"metadata": {},
"source": [
"The command:"
"The command: mkdir lorem-copy\n",
"cd lorem\n",
"cp sed.txt ../lorem-copy/"
]
},
{
Expand All @@ -83,10 +85,10 @@
]
},
{
"cell_type": "markdown",
"cell_type": "raw",
"metadata": {},
"source": [
"The command:"
"The command: cp at.txt ../lorem-copy/; cp lorem.txt ../lorem-copy/"
]
},
{
Expand All @@ -99,10 +101,10 @@
]
},
{
"cell_type": "markdown",
"cell_type": "raw",
"metadata": {},
"source": [
"The command:"
"The command: cat sed.txt"
]
},
{
Expand All @@ -115,10 +117,10 @@
]
},
{
"cell_type": "markdown",
"cell_type": "raw",
"metadata": {},
"source": [
"The command:"
"The command: cat at.txt; cat lorem.txt"
]
},
{
Expand All @@ -131,10 +133,13 @@
]
},
{
"cell_type": "markdown",
"cell_type": "raw",
"metadata": {},
"source": [
"The command:"
"The command: \n",
"cd ..\n",
"cd lorem-copy\n",
"head -3 sed.txt"
]
},
{
Expand All @@ -147,10 +152,11 @@
]
},
{
"cell_type": "markdown",
"cell_type": "raw",
"metadata": {},
"source": [
"The command:"
"The command:\n",
"tail -3 sed.txt"
]
},
{
Expand All @@ -163,10 +169,13 @@
]
},
{
"cell_type": "markdown",
"cell_type": "raw",
"metadata": {},
"source": [
"The command:"
"The command:\n",
"\n",
"echo \"Homo homini lupus\" >> sed.txt\n",
"cat sed.txt (to check)"
]
},
{
Expand All @@ -179,10 +188,11 @@
]
},
{
"cell_type": "markdown",
"cell_type": "raw",
"metadata": {},
"source": [
"The command:"
"The command:\n",
"tail -3 sed.txt"
]
},
{
Expand All @@ -195,10 +205,16 @@
]
},
{
"cell_type": "markdown",
"cell_type": "raw",
"metadata": {},
"source": [
"The command:"
"The command:\n",
"sed -i -e 's/et/ET/g' at.txt\n",
"\n",
"this works but also creates a new file (at.txt-e) which I can't open\n",
"also adding: \n",
"\n",
"rm at.txt-e"
]
},
{
Expand All @@ -211,10 +227,11 @@
]
},
{
"cell_type": "markdown",
"cell_type": "raw",
"metadata": {},
"source": [
"The command:"
"The command:\n",
"whoami"
]
},
{
Expand All @@ -227,10 +244,11 @@
]
},
{
"cell_type": "markdown",
"cell_type": "raw",
"metadata": {},
"source": [
"The command:"
"The command: \n",
"pwd"
]
},
{
Expand All @@ -243,10 +261,11 @@
]
},
{
"cell_type": "markdown",
"cell_type": "raw",
"metadata": {},
"source": [
"The command:"
"The command: \n",
"git ls-files '*.txt'"
]
},
{
Expand All @@ -259,10 +278,11 @@
]
},
{
"cell_type": "markdown",
"cell_type": "raw",
"metadata": {},
"source": [
"The command:"
"The command:\n",
"wc sed.txt"
]
},
{
Expand All @@ -275,10 +295,13 @@
]
},
{
"cell_type": "markdown",
"cell_type": "raw",
"metadata": {},
"source": [
"The command:"
"The command:\n",
"cd ..\n",
"cd ..\n",
"find . -name 'lorem*' | wc -l"
]
},
{
Expand All @@ -291,10 +314,14 @@
]
},
{
"cell_type": "markdown",
"cell_type": "raw",
"metadata": {},
"source": [
"The command:"
"The command:\n",
"cd lab-bash\n",
"cd lorem\n",
"\n",
"grep -o \"et\" at.txt"
]
},
{
Expand All @@ -307,10 +334,11 @@
]
},
{
"cell_type": "markdown",
"cell_type": "raw",
"metadata": {},
"source": [
"The command:"
"The command:\n",
"grep -o \"et\" at.txt | wc -l"
]
},
{
Expand All @@ -323,10 +351,12 @@
]
},
{
"cell_type": "markdown",
"cell_type": "raw",
"metadata": {},
"source": [
"The command:"
"The command:\n",
"\n",
"grep 'et' ./lorem-copy/*.* | wc -l\n"
]
},
{
Expand All @@ -346,10 +376,11 @@
]
},
{
"cell_type": "markdown",
"cell_type": "raw",
"metadata": {},
"source": [
"The command:"
"The command:\n",
"name=Edu"
]
},
{
Expand All @@ -362,10 +393,11 @@
]
},
{
"cell_type": "markdown",
"cell_type": "raw",
"metadata": {},
"source": [
"The command:"
"The command:\n",
"echo $name"
]
},
{
Expand All @@ -378,10 +410,11 @@
]
},
{
"cell_type": "markdown",
"cell_type": "raw",
"metadata": {},
"source": [
"The command:"
"The command: \n",
"mkdir $name"
]
},
{
Expand All @@ -394,10 +427,11 @@
]
},
{
"cell_type": "markdown",
"cell_type": "raw",
"metadata": {},
"source": [
"The command:"
"The command:\n",
"rm -r $name"
]
},
{
Expand All @@ -414,10 +448,29 @@
]
},
{
"cell_type": "markdown",
"cell_type": "raw",
"metadata": {},
"source": [
"The command:"
"The command:\n",
"\n",
"to print the file names:\n",
"for i in *\n",
"do\n",
" echo $i\n",
"done\n",
"\n",
"length of file names: \n",
"\n",
"for i in *\n",
"do\n",
" ${#i}\n",
"done\n",
"\n",
"to print outputs:\n",
"\n",
"for i in *\n",
"> do echo $i \"has\" ${#i} \"characters length\"\n",
"> done"
]
},
{
Expand Down Expand Up @@ -536,7 +589,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.8"
"version": "3.11.4"
},
"nbTranslate": {
"displayLangs": [
Expand Down
Loading