第四周作业——统计/etc/init.d/functions文件中每个单词的出现次数,并排序(用grep和sed两种方法分别实现)

统计/etc/init.d/functions文件中每个单词的出现次数,并排序(用grep和sed两种方法分别实现)

方法一:grep实现

grep -o "\<[[:alpha:]]\+\>" /etc/init.d/functions |sort |uniq -c
grep -o '[[:alpha:]]\+' /etc/init.d/functions | sort |uniq -c

 

[root@centos7 data]# grep  -o "\<[[:alpha:]]\+\>" /etc/init.d/functions |sort |uniq -c
     21 a
      5 A
      1 aA
      1 abnormally
      5 action
      1 active
      1 ActiveState
      1 adjust
      1 alive
      2 all
      1 already
      2 and
      1 And
      3 any
      1 anywhere
      1 Apply
      1 are
      1 arg
      2 at
      1 avoid
      7 awk
      8 b
      1 backup
      2 bak
     29 base
      2 basename
      2 bash
      7 be
      6 BEGIN
      1 bg
     13 bin
     11 binary
      1 bit
      2 booleans
      1 boot
     21 BOOTUP
      2 break
      3 but
      1 by
      6 c
      1 caller
      3 can
      8 case
      1 cat
      1 centi
      2 cgexec
      6 cgroup
      1 Cgroups
      4 check
      2 Check
      2 checkpid
      1 cmdline
      1 code
     13 color
      2 COLUMNS
      3 command
      1 condrestart
      5 conf
      2 configuration
      1 confusing
      1 consoletype
      4 CONSOLETYPE
      2 contains
      9 continue
      1 Convert
      1 core
      4 corelimit
      1 could
      1 current
     27 d
      5 daemon
      1 daemons
      3 dead
      1 debug
      1 deci
      1 declared
      1 default
     11 delay
      1 deleted
      1 dependencies
      1 details
     17 dev
      1 dies
      1 directory
      1 dirname
     10 do
      1 doc
      1 doesn
     10 done
      2 due
      1 dump
      6 e
     49 echo
      1 Echo
      3 eE
      1 elif
      9 else
      5 en
      1 END
      5 eq
      1 errors
      8 esac
     16 etc
      2 Evaluate
      1 exe
      3 exists
      4 exit
      1 exited
      1 export
      1 expression
      1 eyes
     12 f
      1 fail
      1 failed
      1 FAILED
      7 failure
      4 fF
     51 fi
     23 file
      3 files
      1 filter
      2 find
      1 Find
      2 First
      2 foo
     12 for
      5 force
      2 found
      1 from
      1 fsck
      4 function
      2 functions
      1 further
      1 g
      1 G
      1 generated
      1 Get
      4 gotbase
      1 graphical
      3 grep
      1 h
      2 had
      1 have
      2 honor
      5 i
     60 if
      1 ignore
      1 IGNORECASE
      1 ignored
     25 in
      1 including
      1 Inform
      6 init
      1 initialize
      2 initscripts
      1
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值