From bf6d9cced164ca7d83db1a48991838af6b14be02 Mon Sep 17 00:00:00 2001 From: 10215501450 <3027381476@qq.com> Date: Mon, 12 Sep 2022 22:21:49 +0800 Subject: [PATCH] add 10215501450 --- lab1/10215501450.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 lab1/10215501450.sh diff --git a/lab1/10215501450.sh b/lab1/10215501450.sh new file mode 100644 index 0000000..019375d --- /dev/null +++ b/lab1/10215501450.sh @@ -0,0 +1,28 @@ +作业1: +#生成50000行文件 +for i in $(seq 1 50000) +do + echo $RANDOM|md5sum|cut -c 1-9 +done >> test.txt + +#按照字母顺序排序,输出unique行 +sort -u test.txt + +#按照数字顺序排序,输出unique行 +sort -u -n test.txt + +#以覆盖写的方式重定向到一个文件(1.txt) +sort -u test.txt > 1.txt +sort -u -n test.txt > 1.txt + +#以追加写的方式重定向到一个文件(2.txt) +sort -u test.txt >> 2.txt +sort -u -n test.txt >> 2.txt + +作业2: +#已随机生成文件 +#找"computer" +grep "computer" computer.txt + +#统计其中包含多少"computer" +grep -o "computer" computer.txt|wc -w