View Full Version : regular expressions with grep
Swab
January 1st, 2006, 11:47 PM
I want to search for any occurance of 45104 following any tabs or spaces... I'm new to regular expressions and don't understand why the following is not working.
egrep '\t+45104' input.txt
Any pointers?
toojays
January 2nd, 2006, 02:27 AM
I just had a try of this myself, and it seems like the tab escape isn't being interpreted properly for some reason. For me, it worked when I used a literal tab instead of a '\t'. You can type a literal tab in the shell by pressing Control-V and then hitting TAB.
To do what you really want, you need:
egrep '[<literal-tab><literal space>]+45104' input.txt
so that it can be tabs OR spaces in front of the number.
Swab
January 2nd, 2006, 02:43 AM
That worked! Thanks for the help, much appreciated!
crazycrazyeco
June 27th, 2012, 08:21 AM
ctrl-v and tab. Great. It works. thanks.
sisco311
June 27th, 2012, 10:29 PM
Old thread closed.
Powered by vBulletin® Version 4.2.2 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.