Let's say we have a string "test123"
in a text file.
How do we cut out "test12"
only or let's say there is other garbage behind "test123"
such as test123x19853
and we want to cut out "test123x"
?
I tried with grep -a "test123.\{1,4\}" testasd.txt
and so on, but just can't get it right.
I also looked for example, but never found what I'm looking for.
What you need is
-o
which print out matched things only: