From 603eed911d0426d5d30f1021505b7f16a62020b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BD=AD=E4=B8=80=E7=8F=85?= <1753710808@qq.com> Date: Sat, 10 Sep 2022 22:01:06 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=87=B3=20'lab1'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lab1/hw1.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 lab1/hw1.sh diff --git a/lab1/hw1.sh b/lab1/hw1.sh new file mode 100644 index 0000000..709c1e9 --- /dev/null +++ b/lab1/hw1.sh @@ -0,0 +1,11 @@ +sort data.txt | uniq -u +sort -n data.txt | uniq -u +sort data.txt > data2 +sort -n data.txt > data3 +sort data.txt >> data2 +sort -n data.txt >> data3 + +grep ABC data.txt +grep -o ABC data.txt +grep ABC data.txt | wc -l +grep -o ABC data.txt | wc \ No newline at end of file -- 2.8.3 From 30dff13665bfe669cbeb3994268984684aea8c69 Mon Sep 17 00:00:00 2001 From: GentleCold <1952173800@qq.com> Date: Sat, 10 Sep 2022 23:24:22 +0800 Subject: [PATCH 2/8] hw1 from 10215501413 --- lab1/10215501413.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 lab1/10215501413.sh diff --git a/lab1/10215501413.sh b/lab1/10215501413.sh new file mode 100644 index 0000000..6a19473 --- /dev/null +++ b/lab1/10215501413.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# 读取随机数据并转为 base64 编码 +head -n 50000 /dev/urandom | base64 > random; +# 抽取 50000 行数据 +head -n 50000 random > random2; +# rename +rm random; +mv random2 random; + +# 按 asc 排序 +sort --unique random > unique_sort_by_asc; +# 按 num 排序 +sort --unique --numeric-sort random > unique_sort_by_num; + +# 追加写 +cat unique_sort_by_asc > totall; +cat unique_sort_by_num >> totall; + +# 匹配并统计字符 +grep -o "com" totall | wc -l > number_of_com; \ No newline at end of file -- 2.8.3 From fa05b1c021d84e62b2efb4f4a066be159cefdafa Mon Sep 17 00:00:00 2001 From: 10211900416 <10211900416@stu.ecnu.edu.cn> Date: Sun, 11 Sep 2022 10:21:59 +0800 Subject: [PATCH 3/8] commit from 10211900416 --- lab1/10211900416.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 lab1/10211900416.sh diff --git a/lab1/10211900416.sh b/lab1/10211900416.sh new file mode 100644 index 0000000..9671ef8 --- /dev/null +++ b/lab1/10211900416.sh @@ -0,0 +1,23 @@ +#!/bin/bash +chmod +x ./work1.sh #add permisson to execute +rm strings +rm sort_by_ascii +rm sort_by_num +rm summ +rm strings2 +for i in `seq 1000`; #50000 lines is too long to wait, choose 1000 lines +do + echo $RANDOM | md5sum | cut -c 1-9 ; +done >> strings +export LC_ALL=C +sort -d strings | uniq -u > sort_by_ascii +sort -n strings | uniq -u > sort_by_num +cat sort_by_ascii >> summ +cat sort_by_num >> summ + +for i in `seq 666`; #generate a file randomly +do + echo $RANDOM | md5sum | cut -c 1-9; +done >> strings2 +grep -o "de" strings2 | wc -w + -- 2.8.3 From 462cd19f46267d4e8ddc3deb89c736d966db04cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E5=87=AF=E6=81=92?= <2980811196@qq.com> Date: Sun, 11 Sep 2022 10:49:45 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=87=B3=20'lab1'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lab1/10215501406.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 lab1/10215501406.txt diff --git a/lab1/10215501406.txt b/lab1/10215501406.txt new file mode 100644 index 0000000..46c91b3 --- /dev/null +++ b/lab1/10215501406.txt @@ -0,0 +1,13 @@ +#1 +for i in `seq 50000`;do echo $RANDOM | md5sum | cut -c 1-9 ;done > 1.txt +sort -d 1.txt | uniq +sort -n 1.txt | uniq +sort -d 1.txt | uniq > 1_uniq1.txt +sort -n 1.txt | uniq > 1_uniq1.txt +sort -d 1.txt | uniq >> 1_uniq2.txt +sort -n 1.txt | uniq >> 1_uniq2.txt + +#2 +for i in `seq 50000`;do echo $RANDOM | md5sum | cut -c 1-9 ;done > 2.txt +grep 'computer' 2.txt +grep -o 'computer' 2.txt | wc -l \ No newline at end of file -- 2.8.3 From 2e03e33cc0956d1f9e36ddcaeadc74623da8cae9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E5=87=AF=E6=81=92?= <2980811196@qq.com> Date: Sun, 11 Sep 2022 11:08:00 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'lab1/10215501406.txt'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lab1/10215501406.txt | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lab1/10215501406.txt b/lab1/10215501406.txt index 46c91b3..a50d518 100644 --- a/lab1/10215501406.txt +++ b/lab1/10215501406.txt @@ -1,13 +1,13 @@ -#1 -for i in `seq 50000`;do echo $RANDOM | md5sum | cut -c 1-9 ;done > 1.txt -sort -d 1.txt | uniq -sort -n 1.txt | uniq -sort -d 1.txt | uniq > 1_uniq1.txt -sort -n 1.txt | uniq > 1_uniq1.txt -sort -d 1.txt | uniq >> 1_uniq2.txt -sort -n 1.txt | uniq >> 1_uniq2.txt - -#2 -for i in `seq 50000`;do echo $RANDOM | md5sum | cut -c 1-9 ;done > 2.txt -grep 'computer' 2.txt +#1 +for i in `seq 50000`;do echo $RANDOM | md5sum | cut -c 1-9 ;done > 1.txt +sort -d 1.txt | uniq +sort -n 1.txt | uniq +sort -d 1.txt | uniq > 1_uniq_by_asc.txt +sort -n 1.txt | uniq > 1_uniq_by_num.txt +cat 1_uniq_by_asc.txt | uniq >> 1_uniq_total.txt +cat 1_uniq_by_num.txt | uniq >> 1_uniq_total.txt + +#2 +for i in `seq 50000`;do echo $RANDOM | md5sum | cut -c 1-9 ;done > 2.txt +grep 'computer' 2.txt grep -o 'computer' 2.txt | wc -l \ No newline at end of file -- 2.8.3 From bb262b3db4a1a9e7de88ab6affc5916a456447d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E5=87=AF=E6=81=92?= <2980811196@qq.com> Date: Sun, 11 Sep 2022 11:17:22 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=87=B3=20'lab1'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lab1/10215501406.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 lab1/10215501406.sh diff --git a/lab1/10215501406.sh b/lab1/10215501406.sh new file mode 100644 index 0000000..a50d518 --- /dev/null +++ b/lab1/10215501406.sh @@ -0,0 +1,13 @@ +#1 +for i in `seq 50000`;do echo $RANDOM | md5sum | cut -c 1-9 ;done > 1.txt +sort -d 1.txt | uniq +sort -n 1.txt | uniq +sort -d 1.txt | uniq > 1_uniq_by_asc.txt +sort -n 1.txt | uniq > 1_uniq_by_num.txt +cat 1_uniq_by_asc.txt | uniq >> 1_uniq_total.txt +cat 1_uniq_by_num.txt | uniq >> 1_uniq_total.txt + +#2 +for i in `seq 50000`;do echo $RANDOM | md5sum | cut -c 1-9 ;done > 2.txt +grep 'computer' 2.txt +grep -o 'computer' 2.txt | wc -l \ No newline at end of file -- 2.8.3 From 1074dc5de462cc80e58d7997e5b6729f7096a7a3 Mon Sep 17 00:00:00 2001 From: lizepeng <1224060318@qq.com> Date: Sun, 11 Sep 2022 11:44:49 +0800 Subject: [PATCH 7/8] 10215501417's commit --- lab1/10215501417.sh | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 lab1/10215501417.sh diff --git a/lab1/10215501417.sh b/lab1/10215501417.sh new file mode 100644 index 0000000..b22392a --- /dev/null +++ b/lab1/10215501417.sh @@ -0,0 +1,67 @@ +#!/bin/bash + +#生成50000行包含字母与数字的文件 +#需要从urandom中读取字母与数字,共50000次循环,大概需要5-10min左右。 +for((i = 0; i < 50000; i++)) +do +head -c 50 /dev/urandom | tr -dc A-Za-z0-9 >> RandFile; +echo -e \ >> RandFile; +done + +#按字母排序 +sort RandFile | uniq; +#按数字排序 +sort -n RandFile | uniq; +#重定向到SortedFile1 +sort RandFile | uniq >> SortedFile1; +#重定向到SortedFile2 +sort -n RandFile >> SortedFile2; + +#统计RandFile中 ab 出现的次数 +grep -o ab RandFile|wc -l; + +#git push到码园 +git init #初始化 +git add . #添加文件夹下所有文件 +git commit -m "lab1 first commit" #把添加的文件提交到远程版本库 +git remote add origin https://gitea.shuishan.net.cn/10215501417/csapp.git #建立远程连接 +git push -u origin master #上传代码#!/bin/bash + +#生成50000行包含字母与数字的文件 +#需要从urandom中读取字母与数字,共50000次循环,大概需要5-10min左右。 +for((i = 0; i < 50000; i++)) +do +head -c 50 /dev/urandom | tr -dc A-Za-z0-9 >> RandFile; +echo -e \ >> RandFile; +done + +#按字母排序 +sort RandFile | uniq; +#按数字排序 +sort -n RandFile | uniq; +#重定向到SortedFile1 +sort RandFile | uniq >> SortedFile1; +#重定向到SortedFile2 +sort -n RandFile >> SortedFile2; + +#统计RandFile中 ab 出现的次数 +grep -o ab RandFile|wc -l; + +#git push到码园 +git init #初始化 +git add . #添加文件夹下所有文件 +git commit -m "lab1 first commit" #把添加的文件提交到远程版本库 +git remote add origin https://gitea.shuishan.net.cn/10215501417/csapp.git #建立远程连接 +git push -u origin master #上传代码 + +#fork工作流: +#首先 fork目标仓库到自己的远程仓库 +#再git clone到自己的仓库 +git clone https://gitea.shuishan.net.cn/10215501417/Computer-Systems-Labs.git +#创建一个分支 +git checkout -b hw +#将代码文件上传 +git add 10215501417.sh +git commit -m "10215501417's cmommit" +#然后再发起一个pr到目标仓库 + -- 2.8.3 From 7bd805043cf872f876a153c9b16d98fb76f8a500 Mon Sep 17 00:00:00 2001 From: lizepeng <1224060318@qq.com> Date: Sun, 11 Sep 2022 11:54:02 +0800 Subject: [PATCH 8/8] 10215501417's commit --- lab1/10215501417.sh | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/lab1/10215501417.sh b/lab1/10215501417.sh index b22392a..10d6392 100644 --- a/lab1/10215501417.sh +++ b/lab1/10215501417.sh @@ -25,33 +25,6 @@ git init #初始化 git add . #添加文件夹下所有文件 git commit -m "lab1 first commit" #把添加的文件提交到远程版本库 git remote add origin https://gitea.shuishan.net.cn/10215501417/csapp.git #建立远程连接 -git push -u origin master #上传代码#!/bin/bash - -#生成50000行包含字母与数字的文件 -#需要从urandom中读取字母与数字,共50000次循环,大概需要5-10min左右。 -for((i = 0; i < 50000; i++)) -do -head -c 50 /dev/urandom | tr -dc A-Za-z0-9 >> RandFile; -echo -e \ >> RandFile; -done - -#按字母排序 -sort RandFile | uniq; -#按数字排序 -sort -n RandFile | uniq; -#重定向到SortedFile1 -sort RandFile | uniq >> SortedFile1; -#重定向到SortedFile2 -sort -n RandFile >> SortedFile2; - -#统计RandFile中 ab 出现的次数 -grep -o ab RandFile|wc -l; - -#git push到码园 -git init #初始化 -git add . #添加文件夹下所有文件 -git commit -m "lab1 first commit" #把添加的文件提交到远程版本库 -git remote add origin https://gitea.shuishan.net.cn/10215501417/csapp.git #建立远程连接 git push -u origin master #上传代码 #fork工作流: -- 2.8.3