You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 regels
620 B

2 jaren geleden
  1. #生成文件
  2. for i in `seq 5000`;
  3. do echo $RANDOM | md5sum | cut -c 1-9;
  4. done>>test.txt;
  5. #1
  6. sort -u test.txt #按字母排序
  7. sort -u -n test.txt #按数字排序
  8. sort -u test.txt>1.txt #将字母排序结果覆盖写到1.txt中
  9. sort -u test.txt>>2.txt #将字母排序结果追加写到2.txt中
  10. sort -u -n test.txt>1.txt #将数字排序结果覆盖写到1.txt中
  11. sort -u -n test.txt>>2.txt #将数字排序结果追加写到2.txt中
  12. #2
  13. grep "abc" test.txt #找出内容包含"abc"的字符串并输出
  14. grep -c "abc" test.txt #统计内容包含"abc"的行数并输出