Linux / UNIX Tech Support Forum
This is a discussion on searching words in two files within the Shell scripting forums, part of the Development/Scripting category; Hi How can i search words in two files. suppose: file1 have the following words: ABCDEFGH and file2 have: ABCDEFGHIJKLMNOPQRST ...
|
|||||||
| Shell scripting You can discuss the shell scripting, request shell scripts and scripting techniques |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi
How can i search words in two files. suppose: file1 have the following words: ABCDEFGH and file2 have: ABCDEFGHIJKLMNOPQRST How is it possible to search the words which are in file1 from file2??? Means file1 give the required words to be search in file2 Normally we use 'grep' command. e.g.: grep word filename If any script has to be write, please mention Regards Asim |
| Sponsored Links | ||
|
|
|
||||
|
Assuming that there is only one word in file1
Code:
word=$(cat file1) grep $word file2
__________________
Vivek Gite Linux Evangelist |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Shell Script for Searching a String | vivekv | Shell scripting | 7 | 10-03-2009 03:18 AM |
| Sed Insert Text Between Two Words | LinuxCommandos | Shell scripting | 1 | 06-11-2008 05:16 PM |
| Please help me searching files in linux | praveenjayak | Linux software | 3 | 15-06-2008 10:44 PM |
| Linux searching for files in the server | jerry | Getting started tutorials | 1 | 20-06-2006 05:12 PM |
| searching for bad words script | marinm | Shell scripting | 1 | 03-02-2005 04:32 PM |