Work with sed and grep
$ b=/homes/ddailey/public_html/data/wordstudy/BNCwordfreq63007
Point to a large list of words with word frequencies
$ head -5 $b
the 6187267
of 2941444
and 2682863
a 2126369
in 1812609
Look for three consecutive occurrences of same character:
$ grep "\(.\)\1\1" $b|head -5
of 2941444
for 833360
that 628999
two 156111
very 111538
And...
$ grep "\(.\)\1\1" $b|tail
xxiii 35
faithfullly 31
ooo 28
waaagh 25
sssis 24
aaa 22
uuuc 20
diii 20
xxviii 17
yccc 16
Why doesn't this work?
Outputting only the first field:
$ awk '{print $1}' $b|head -5
the
of
and
a
inOr:
$ sed s/\ .*// $b|head -5
the
of
and
a
in
Now... which of these would be computationally more efficient:
$ sed s/\ .*// $b|grep "\(.\)\1\1"|head
iii
viii
mmm
xiii
xxx
ahhh
mmmm
ccc
xviii
oooh
Or:
$ grep "\(.\)\1\1" $b|grep -v "[0-9]\{3\}"|tail
xxiii 35
faithfullly 31
ooo 28
waaagh 25
sssis 24
aaa 22
uuuc 20
diii 20
xxviii 17
yccc 16More importantly, perhaps, are these equivalent?