Reputation: 29
I have a large log file with thousands of lines: (example)
3125 = adugbo1root1.gr-u.it_1449288148_C1_HDR
3126 = adugbo1dir1.direzione.gr-u.it_1449288167_C1_HDR
3128 = adugbovdir2.direzione.gr-u.it_1449288072_C1_F3
3129 = adugbovaage1.aurage.lan_1449288143_C1_F1
3130 = adubbovugfb01.ugfbanca.lan_1449288049_C1_F3
3132 = adugbo1sfinge.aurora.lan_1449288054_C1_F3
3133 = adugbo1root1.gr-u.it_1449288149_C1_F1
3134 = adugbovaage1.aurage.lan_1449288144_C1_F1
3135 = adugbo1root1.gr-u.it_1449288148_C1_F1
3136 = adugbo1root1.gr-u.it_1449288147_C1_F1
3137 = adugbo1dir1.direzione.gr-u.it_1449288167_C1_F1
3138 = adugbo1dir1.direzione.gr-u.it_1449288169_C1_HDR
3139 = adugbo1dir1.direzione.gr-u.it_1449288168_C1_HDR
3140 = adugbovroot2.gr-u.it_1449288069_C1_F3
I have a smaller list of numbers that i need to pull the lines from this log file.
i.e.
3130 = adubbovugfb01.ugfbanca.lan_1449288049_C1_F3
3138 = adugbo1dir1.direzione.gr-u.it_1449288169_C1_HDR
I can run a regex search for (3130)|(3138)|....
However this is not searching for a "match whole word only".
I.e. the same search will pull out:
23130 = pegasoweb.servizi.gr-u.it_1449948649_C1_F60
43138 = apunbovazoto.servizi.gr-u.it_1450647109_C1_F57
How can i run a regex search for only the string in the bracket?
Upvotes: 1
Views: 545
Reputation: 1238
Prepend your regular expression with a ^
to indicate the start of the line. Add \s
at the end to match the whitespace.
Upvotes: 2