Преглед на файлове

Merge pull request '添加 'lab1/10215501435.sh'' (#10) from 10215501435/Computer-Systems-Labs:master into master

Reviewed-on: https://gitea.shuishan.net.cn/52265903006/Computer-Systems-Labs/pulls/10
master
朱君鹏 преди 2 години
родител
ревизия
af937dc63d
променени са 1 файла, в които са добавени 23 реда и са изтрити 0 реда
  1. +23
    -0
      lab1/10215501435.sh

+ 23
- 0
lab1/10215501435.sh Целия файл

@ -0,0 +1,23 @@
#!/bin/bash
#生成50行随机字符串
for i in {1..50}
do
echo $RANDOM | md5sum | cut -c 1-9 >> random_50.txt
done
#将上述50行随机的字符串循环100次,得到5000行有规律的字符串
times=1
while((times<=100))
do
head -n 50 random_50.txt >> random_5000.txt
times=`expr $times + 1`
done
#以覆盖写的方式,字母排序,输出unique行
sort -u random_5000.txt > alph.txt
#以覆盖写的方式,数字排序,输出unique行
sort -u -n random_5000.txt > number.txt
#以追加写的方式,字母排序,输出unique行
sort -u random_5000.txt >> alph.txt
#以追加写的方式,数字排序,输出unique行
sort -u -n random_5000.txt >> number.txt
#已经生成一个含有60个Computer的letter文件
grep -c "Computer" letter.txt

Зареждане…
Отказ
Запис