The UNIX and Linux Forums
>
Top Forums
>
Shell Programming and Scripting
Extracting a string from one file and searching the same string in other files
User Name
Remember Me?
Password
Google UNIX.COM
Forums
Directory
Register
Forum Rules
FAQ
Contribute
Members List
Search
Today's Posts
Mark Forums Read
Thread
:
Extracting a string from one file and searching the same string in other files
View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
#
2
(
permalink
)
09-19-2007
SanjayLinux
Registered User
Join Date: Sep 2007
Posts: 58
Try This one
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
SanjayLinux
View Public Profile
Find all posts by SanjayLinux