Ver código fonte
Merge pull request #9 from yrrrrq/main
add lab1 homework 10215501443
main
Eugene Zhu
2 anos atrás
committed by
GitHub
Nenhuma chave conhecida encontrada para esta assinatura no banco de dados
ID da chave GPG: 4AEE18F83AFDEB23
1 arquivos alterados com
32 adições e
0 exclusões
-
lab1/10215501443.sh
|
|
@ -0,0 +1,32 @@ |
|
|
|
第一题 |
|
|
|
随机生成50000行的文件 |
|
|
|
for i in {1..50000} |
|
|
|
>do |
|
|
|
>echo $RANDOM | md5sum | cut -c 1-9 >> hw1.txt |
|
|
|
>done |
|
|
|
|
|
|
|
按数字排序 追加写的方式重定向 |
|
|
|
sort -n hw1.txt -u >> 3.txt |
|
|
|
|
|
|
|
按数字排序 覆盖写的方式重定向 |
|
|
|
sort -n hw1.txt -u > 4.txt |
|
|
|
|
|
|
|
按字母排序 追加写的方式重定向 |
|
|
|
sort -f hw1.txt -u >> 5.txt |
|
|
|
|
|
|
|
按字母排序 覆盖写的方式重定向 |
|
|
|
sort -f hw1.txt -u > 6.txt |
|
|
|
|
|
|
|
|
|
|
|
第二题 |
|
|
|
随机生成一个文件 |
|
|
|
for i in {1..500} |
|
|
|
> do |
|
|
|
> echo $RANDOM | md5sum | cut -c 1-9 >> hw2.txt |
|
|
|
> done |
|
|
|
|
|
|
|
查找指定字符串fe |
|
|
|
grep 'fe' hw2.txt |
|
|
|
|
|
|
|
统计字符串fe出现次数 |
|
|
|
grep -o "fe" hw2.txt | wc -l |