#!/bin/bash
(1) awk '{for (i = 1; i <= NF; i++) if($i == "UCanUup") ++sum}END {print "Sum:"sum}' test.txt
(2) grep -o "UCanUup" test.txt | wc -l
====================================================================================
#!/usr/bin/python
import re
txt = open('./test.txt', "r").read()
print (len(re.findall("UCanUup", txt)))
阅读(1333) | 评论(0) | 转发(0) |