How to keep only some keywords in text file
Yes. In which language do you want it?
example in Smalltalk:
((FileStream fileNamed: 'emails.txt')
substrings: eMailSeparatorChar)
reject: [:a|a includesSubString: aKeyWord]
Assuming each email is in single line
grep -wEi 'gmail|yahoo|aol' emailFile
-w for words
-i Case insensitive
emailFile is the file containing emails .
following changes the input file.
grep -wEi 'gmail|yahoo|aol' emailFile > tempFile && cp tempFile emailFile && rm tempFile
If you want to add more to the list just add '|' serviceProvide
精彩评论