[SOLVED] How to Regex Repetition? (grep)
Hello!
I want to make a bash script in linux, using terminal commands, and I'm stuck at the very beginning
I have the following text file:
[start of file]
[tabkey]text1
text2
[tabkey][tabkey]text3
[end of file]
Each of the above text is in its own line, so there are 3 lines in total. The first line has 1 tab, the 3rd has 2 tabs at the start.
If I use
grep $'\t'
I get all lines with tabs, but not highlighted ofc.
So I ended up using
grep $'\t'".*"
to get text1 and text3.
However, how can I get only 1 \t?
I want to get exclusively text1, or exclusively text3, depending on tab count. I ask this because I can't grasp my head around repetition, {N} to repeat the previous command doesn't seem to work even for letters, yet I need it for the tab character.