Reputation: 2559
Good day to all,
I was wondering how to find the line number of a line with only commas. The only but is that I don't know how many commas
have each line:
Input:
...
Total,Total,,,
,,,,
,,,,
Alemania,,1.00,,
...
Thanks in advance for any clue
Upvotes: 0
Views: 227
Reputation: 16061
You can do this with a single command:
egrep -n '^[,]+$' file
Line numbers will be prefixed.
Result with your provided four test lines:
2:,,,,
3:,,,,
Now, if you only want the line numbers, you can cut them easily:
egrep -n '^[,]+$' file | cut -d: -f1
Upvotes: 3