Code/Approach Golf: Find row in text file with too many columns
Posted
by awshepard
on Stack Overflow
See other posts from Stack Overflow
or by awshepard
Published on 2010-06-08T19:05:53Z
Indexed on
2010/06/08
19:12 UTC
Read the original article
Hit count: 278
code-golf
|text-parsing
Given a text file that is supposed to contain 10 tab-delimited columns (i.e. 9 tabs), I'd like to find all rows that have more than 10 columns (more than 9 tabs). Each row ends with CR-LF.
Assume nothing about the data, field widths, etc, other than the above.
Comments regarding approach, and/or working code would be extremely appreciated. Bonus for printing line numbers of offending lines as well.
Thanks in advance!
© Stack Overflow or respective owner