Browse Source

Merge pull request #5 from oncetrange/main

10215501414 homework
main
Eugene Zhu 2 years ago
committed by GitHub
parent
commit
9fccc810ff
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 0 deletions
  1. +16
    -0
      lab1/10215501414.sh

+ 16
- 0
lab1/10215501414.sh View File

@ -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"的行数并输出

Loading…
Cancel
Save