wechat怎么在kindle fire hdx上不能update阿# PDA - 掌中宝
h*3
1 楼
a startup company. requires using java.
1. input is a file log.data
I am good
I am better
I am excellent
output:
I 3
am 3
good 1
better 1
excellent 1
My idea:
read the file line by line
for each word within that line
cal a hash value of that word
persist the hash value and {word,ocurrences} into hashMap
Iterate the hashMap, output each word and its occurrences.
Cant finish a clean code.
Coding, Coding, Coding is the king
2. using a shell script to count all the lines of all log files under ./
including "Error" keyword
i.e
./a.log
./dir/b.log
./dir1/c.log
count how many lines within those files including "Error"
my answer
find . -name "*.log" -print | xargs grep "Error" | wc -l
1. input is a file log.data
I am good
I am better
I am excellent
output:
I 3
am 3
good 1
better 1
excellent 1
My idea:
read the file line by line
for each word within that line
cal a hash value of that word
persist the hash value and {word,ocurrences} into hashMap
Iterate the hashMap, output each word and its occurrences.
Cant finish a clean code.
Coding, Coding, Coding is the king
2. using a shell script to count all the lines of all log files under ./
including "Error" keyword
i.e
./a.log
./dir/b.log
./dir1/c.log
count how many lines within those files including "Error"
my answer
find . -name "*.log" -print | xargs grep "Error" | wc -l