From e840aec0cd2a51c6d632ceb289a9e1d9bc177c0f Mon Sep 17 00:00:00 2001 From: TheadoraTang <100395166+TheadoraTang@users.noreply.github.com> Date: Sun, 11 Sep 2022 11:41:25 +0800 Subject: [PATCH] Create 10215501437.sh --- lab1/10215501437.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 lab1/10215501437.sh diff --git a/lab1/10215501437.sh b/lab1/10215501437.sh new file mode 100644 index 0000000..8e79b32 --- /dev/null +++ b/lab1/10215501437.sh @@ -0,0 +1,15 @@ +#!/bash/bin +#生成随机字符串 +for i in `seq 1000`;do echo $RANDOM | md5sum | cut -c 1-9 ;done > test.txt +#按照字母顺序排列,输出unique行 +sort -u test.txt | uniq +#按照数字顺序排列,输出unique行 +sort -u -n test.txt | uniq +#以覆盖写的方式重定向到一个文件 +sort -u test.txt | uniq > ans1 +sort -u -n test.txt | uniq > ans1 +#以追加写的方式重定向到一个文件 +sort -u test.txt | uniq >> ans1 +sort -u -n test.txt | uniq >> ans1 +#寻找to +grep -wo "to" test2.txt | wc-l