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