Using egrep, how do I find lines start with a tab? “egrep ‘^t'” doesn’t seem to work and “egrep ‘[[:space:]]'” is too broad.

(You): Using egrep, how do I find lines start with a tab? “egrep ‘^t'” doesn’t seem to work and “egrep ‘[[:space:]]'” is too broad.

(Adam): “egrep ‘^t'” should work. Are you sure you’re dealing with tabs and not multiple spaces? You might also try “egrep ‘^[t]'”, though I don’t see how that’s very different from what you wrote.

(You): thanks. It turns out if you hit ctrl-v in tcsh, the next character is interpreted literally, so you have to do ctrl-v TAB. “t” matches the letter t.

———————-

(Alexander): you should be able to edit a tab into a shell script with e.g. vi, or try to enter a tab with ctrl-q tab in the shell

(Alexander): it turns out ctrl-q tab only works in emacs not in bash

(You): that might’ve worked! My workaround: hit ctrl-v in tcsh, the next character is interpreted literally, so you have to do ctrl-v TAB.

———————-

(John): try /t

(You): thanks. It turns out if you hit ctrl-v in tcsh, the next character is interpreted literally, so you have to do ctrl-v TAB. “t” matches the letter t, even with a backslash before it.

[Vark assigned category: egrep, more details]

This entry was posted in Barry After Vark. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *