I need to identify patterns in a text file for further analysis. So the input files may contain semi-structured text as follows;
905:john: abc123: firstname.lastname@example.org: US 920:eric: ericaA: email@example.com: US 1000: rio: ri0ri0: firstname.lastname@example.org: IN
nathen <tab> email@example.com <tab> 764323545 <tab> UK thomas <tab> firstname.lastname@example.org <tab> 563363421 <tab> UK ian <tab> email@example.com <tab> 3453245472 <tab> SP
number of words in a line may vary for each document. delimiter also vary but unique for each document. what I want is to count number of words per each line in each document.
output would be:
5 5 5 5
4 4 4 4
I want generalize this for any file with any delimiter. It could be
- | : \space+ \tab+.
Some files are as follows:
| firstname.lastname@example.org | er34532 | | email@example.com | 764474 |