![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| searching for a string in a file | ROOZ | UNIX for Dummies Questions & Answers | 2 | 03-07-2008 09:54 AM |
| Searching for files with certain string pattern | intrigue | UNIX for Dummies Questions & Answers | 1 | 02-28-2008 01:28 PM |
| Perl: searching for a string in a file... | pondlife | Shell Programming and Scripting | 4 | 09-17-2007 04:35 AM |
| Complicated string searching in a file | nir_s | Shell Programming and Scripting | 5 | 09-21-2005 04:51 AM |
| searching for a string though file system | peter.herlihy | UNIX for Dummies Questions & Answers | 3 | 12-06-2001 12:19 AM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Extracting a string from one file and searching the same string in other files
Hi,
Need to extract a string from one file and search the same in other files. Ex: I have file1 of hundred lines with no delimiters not even space. I have 3 more files. I should get 1 to 10 characters say substring from each line of file1 and search that string in rest of the files and get the lines containing that string. please help me how to do this using awk or sed in unix. Thanks, Mohan. |
| Forum Sponsor | ||
|
|
|
|||
|
Let say you have file1 without delimeter and you want first 10 char as pattern to search in another files.
#!/bin/sh cut -c1-10 file1 >pattern.txt for pattern in `cat pattern.txt` do find $pattern file_name1 file_name2 done |
|||
| Google UNIX.COM |