Skip to main content
edited body
Source Link
n611x007
  • 1k
  • 4
  • 13
  • 21

I have a tab-tabulated file. I would like to check if every line has the same number of tabs.

For first step, I'd like to print the number of tabs for each individual line.

I've tried grep -o "\t"'\t' infile | wc -l, but my implementation of grep says grep: invalid option -- o. Is there an other way?


Nice to have: if possible, due personal preference, I'd prefer to do this with util (grep, cat, etc.) tools, preferably not awk or bash scripting.

I have a tab-tabulated file. I would like to check if every line has the same number of tabs.

For first step, I'd like to print the number of tabs for each individual line.

I've tried grep -o "\t" infile | wc -l, but my implementation of grep says grep: invalid option -- o. Is there an other way?


Nice to have: if possible, due personal preference, I'd prefer to do this with util (grep, cat, etc.) tools, preferably not awk or bash scripting.

I have a tab-tabulated file. I would like to check if every line has the same number of tabs.

For first step, I'd like to print the number of tabs for each individual line.

I've tried grep -o '\t' infile | wc -l, but my implementation of grep says grep: invalid option -- o. Is there an other way?


Nice to have: if possible, due personal preference, I'd prefer to do this with util (grep, cat, etc.) tools, preferably not awk or bash scripting.

Source Link
n611x007
  • 1k
  • 4
  • 13
  • 21

Count tabs per line in text file with utils

I have a tab-tabulated file. I would like to check if every line has the same number of tabs.

For first step, I'd like to print the number of tabs for each individual line.

I've tried grep -o "\t" infile | wc -l, but my implementation of grep says grep: invalid option -- o. Is there an other way?


Nice to have: if possible, due personal preference, I'd prefer to do this with util (grep, cat, etc.) tools, preferably not awk or bash scripting.