Skip to content

Instantly share code, notes, and snippets.

@usaturn
Created March 18, 2014 15:53
Show Gist options
  • Save usaturn/9622916 to your computer and use it in GitHub Desktop.
Save usaturn/9622916 to your computer and use it in GitHub Desktop.
#!/usr/bin/awk -rf
BEGIN{
list=ARGV[1]
while (getline < list > 0) {
word[$1]++
}
close(list)
}
/.+/{
for(i in word){
regstr=$1
perfect_match_regstr="^"regstr"$"
word_p_status=match(i,perfect_match_regstr)
word_status=match(i,regstr)
if(1==word_p_status) continue
if(0<word_status){
delete word[i]
}
}
}
END{
for(j in word) print j > "blockword.txt"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment