![]() |
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 |
| Shell script to search for text in a file and copy file | imeadows | UNIX for Dummies Questions & Answers | 9 | 11-12-2008 09:12 PM |
| shell script to search content of file with timestamps in the directory | psychobeauty | Shell Programming and Scripting | 10 | 04-21-2008 05:37 AM |
| Shell script to search through numbers and print the output | cdfd123 | Shell Programming and Scripting | 8 | 10-30-2007 04:40 PM |
| Shell script to return all the ID's from file based on the distribution ID search | kumbhatalok | UNIX for Dummies Questions & Answers | 1 | 10-06-2006 12:53 PM |
| Korn Shell Script - Read File & Search On Values | run_unx_novice | Shell Programming and Scripting | 2 | 06-15-2005 07:20 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
hello
have a file1 H87I Y788O T347U J23U and file2 J23U U887Y I99U T556U file3 I99O J99T F557J file4 N99I T666U R55Y file5 H87I T347U file6 H77U R556Y E44T file7 Y788O K98U H8I May be using script we can use file1 to search for all the files and have the output H87I file5 Y788O file7 T347U file5 J23U file2 Thanks |
|
||||
|
Do this..you should get what you want..
while read line do filefound=`grep -l $line file2 file3 file4 file5 file6 file7` output=`echo $filefound | cut -d: -f1` echo "$line $output" done < file1 cheers, Devaraj Takhellambam |
|
||||
|
gud job sir
Quote:
Thanks pretty works with 20 different files ...ha......... |
|
||||
|
awk
Hi,
I think this one is ok. input: Code:
a: H87I Y788O T347U J23U b: file2 J23U U887Y I99U T556U file3 I99O J99T F557J file4 N99I T666U R55Y file5 H87I T347U file6 H77U R556Y E44T file7 Y788O K98U H8I Code:
awk '
{
if (NF==1)
a[$1]=$1
else
for (i in a)
if($2==a[i])
a[i]=$1
}
END{
for (i in a)
print i " "a[i]
}' a b
Code:
H87I file5 J23U file2 T347U T347U Y788O file7 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|