![]() |
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 |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| text manipulation | injeti | Shell Programming and Scripting | 11 | 06-05-2008 10:42 AM |
| file manipulation | tungaw2004 | Shell Programming and Scripting | 2 | 04-04-2008 10:26 PM |
| Text Manipulation. | Icepick | Shell Programming and Scripting | 4 | 02-25-2008 04:18 AM |
| Text file manipulation | svannala | UNIX for Dummies Questions & Answers | 5 | 01-20-2006 07:01 PM |
| shell script : text manipulation (easy quesiton) | champion | Shell Programming and Scripting | 3 | 07-01-2002 03:10 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
I am a new unix user & I wanted to work with unix as it is very good in text manipulations. I need a little help. I will be grateful if someone can help me out.
I need help in grepping a pattern of numbers from one file to another file. Specific details are as follows: File one contains only one column of numbers like 897887738753 881388745527 237818494899 331388745702 451388746000 911388746146 891388746156 file 2 contains three column of numbers 1st column is just the hash mark then another set of numbers & then column 3 (the numbers of my interest). ## 234451388746000 447887738753 ## 234159018106564 447818494899 ## 234159055332992 897887738753 ## 234159043784408 881388745527 ## 234159026266547 237818494899 ## 234154821274370 331388745702 ## 234159053081262 451388746000 ## 234159020233321 911388746146 ## 234159014081879 891388746156 I want to grep numbers in File 1 from 3rd column of file 2 and as a result I should get out put as the whole line in file 2 which has the matching number in column 3 of file 1 I am trying: grep -f file1 file2 > file3 but the problem with it is that if it finds a similar match even in column 2 it prints it. Like in above case output will be ## 234159055332992 897887738753 ## 234159043784408 881388745527 ## 234159026266547 237818494899 ## 234154821274370 331388745702 ## 234159053081262 451388746000 ## 234159020233321 911388746146 ## 234159014081879 891388746156 & ## 234451388746000 447887738753 (which is not right because the 3rd column of file2 does not have any match in file1) One more thing I am using cygwin to create unix enviornment on my windows machine & its not actually a unix machine but just unix environment. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|