![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Linux RedHat, Ubuntu, SUSE, Fedora, Debian, Mandriva, Slackware, Gentoo linux, PCLinuxOS. All Linux questions here! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| grep with regular expression optional value | necroman08 | Shell Programming and Scripting | 11 | 10-05-2009 09:03 AM |
| grep regular expression | Calypso | Shell Programming and Scripting | 7 | 05-18-2009 07:08 AM |
| grep with regular expression | daikeyang | Shell Programming and Scripting | 6 | 03-22-2009 08:46 PM |
| regarding grep regular expression | ukatru | UNIX for Advanced & Expert Users | 2 | 10-22-2008 11:47 PM |
| grep : regular expression | RishiPahuja | Shell Programming and Scripting | 10 | 09-13-2005 12:53 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
how to grep special character regular expression?
Hi
![]() I have 2 files file1: Code:
SNP_A-2208459 SNP_A-4215188 SNP_A-2012248 SNP_A-1882998 file2: Code:
CHR SNP UNADJ BONF HOLM * * * etc. 19 SNP_A-2236481 1.742e-26 5.442e-21 13 SNP_A-4204405 8.643e-07 1.505e-06 3 SNP_A-1860908 4.483e-06 7.279e-06 7 SNP_A-1990194 7.434e-06 1.181e-05 * * * etc. (thousands of rows) Question: I'm using grep -w -f file1 file2 > file3 to match in file2 only the entries listed in file1, BUT this does not work ; the output file3 is giving me everything listed in file2 .Can anyone help? pleaaaaaaaaaaaaase Thank you! Last edited by vgersh99; 09-23-2009 at 05:49 PM.. Reason: code tags, PLEASE! |
|
||||
|
1. -w means word. And -(hyphen) is not a word character.
So file3 will not have any content, ( by the sample input you gave ). Confirm whether you are right in saying that. 2. Solution. Code:
grep -f file1 file2 |
|
||||
|
thegeek;
Thank you for trying to help me, but grep -f file1 file2 > file3 DOES NOT WORK. ---------- Post updated 09-25-09 at 03:56 PM ---------- Previous update was 09-24-09 at 09:47 PM ---------- I also deleted the hyphens, underscores and letters from the in both files but the grep -f file1 file2 > file3 does not work SNP_A-2208459 ---------- Post updated at 03:58 PM ---------- Previous update was at 03:56 PM ---------- Ok, I give up with this forum, I guess nobody wants to help. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|