The UNIX and Linux Forums
>
Top Forums
>
Shell Programming and Scripting
select a record from one file matching from second file using awk
.
User Name
Remember Me?
Password
google unix.com
Forums
Register
Forum Rules
Links
Albums
FAQ
Members List
Calendar
Search
Today's Posts
Mark Forums Read
Thread
:
select a record from one file matching from second file using awk
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
#
3
(
permalink
)
06-06-2008
era
Herder of Useless Cats (On Sabbatical)
Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
You mean something like this?
Code:
sed
-e 's/.*/^&,/' fileb | grep -f - filea
Not all
grep
versions support the
-f
option apparently, but the idea is simply to grep for anything from
fileb
which is in the first field of
filea
.
era
View Public Profile
Visit era's homepage!
Find all posts by era
Find era's past nominations received
Find era's present nominations given