![]() |
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 |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| searching for a string in a file | ROOZ | UNIX for Dummies Questions & Answers | 2 | 03-07-2008 01:54 PM |
| Searching for files with certain string pattern | intrigue | UNIX for Dummies Questions & Answers | 1 | 02-28-2008 05:28 PM |
| Perl: searching for a string in a file... | pondlife | Shell Programming and Scripting | 4 | 09-17-2007 07:35 AM |
| Complicated string searching in a file | nir_s | Shell Programming and Scripting | 5 | 09-21-2005 07:51 AM |
| searching for a string though file system | peter.herlihy | UNIX for Dummies Questions & Answers | 3 | 12-06-2001 04:19 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | 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. |
|
||||
|
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 |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|