From 7b56c989ed550a0b3642ea1acdc93670c49ec4ba Mon Sep 17 00:00:00 2001 From: hyq <467583740@qq.com> Date: Sun, 11 Sep 2022 16:05:57 +0800 Subject: [PATCH] hw --- lab1/10215501414.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 lab1/10215501414.sh diff --git a/lab1/10215501414.sh b/lab1/10215501414.sh new file mode 100644 index 0000000..3b9ad68 --- /dev/null +++ b/lab1/10215501414.sh @@ -0,0 +1,16 @@ + #生成文件 + for i in `seq 5000`; + do echo $RANDOM | md5sum | cut -c 1-9; + done>>test.txt; + + #1 + sort -u test.txt #按字母排序 + sort -u -n test.txt #按数字排序 + sort -u test.txt>1.txt #将字母排序结果覆盖写到1.txt中 + sort -u test.txt>>2.txt #将字母排序结果追加写到2.txt中 + sort -u -n test.txt>1.txt #将数字排序结果覆盖写到1.txt中 + sort -u -n test.txt>>2.txt #将数字排序结果追加写到2.txt中 + + #2 + grep "abc" test.txt #找出内容包含"abc"的字符串并输出 + grep -c "abc" test.txt #统计内容包含"abc"的行数并输出 \ No newline at end of file