🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #1655

Re: How to get AWK to output 2 fields at once

#1655
From: Ronald Pikkert
Date: Mon, 29 Oct 1990 11:39
26 lines
1184 bytes
From article <297@twg.bc.ca>, by bill@twg.bc.ca (Bill Irwin):
<> 
<> Is  there a way to get AWK to output "field_1 field_2" as the value of x,
<> so  that  this  can be used as the search pattern for GREP,  rather  than
<> "field_1" "field_2" "field_1" "field_2"?

Your problem comes up AFTER awk. The for loop that you use
considers spaces to be field seperators and awk outputs spaces 
on your request.

You could do this:

cat file_1 | awk '{ print $1 " " $2 }' | while read x
do
        grep "$x" file_2
done

The read statement will leave the spaces in the awk output
unchanged.


-
Ronald Pikkert                 E-mail: ronald@atcmp.nl
@ AT Computing b.v.            Tel:    080 - 566880
Toernooiveld
6525 ED  Nijmegen
Technical Details
Message-ID: <678@atcmpe.atcmp.nl>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!nih-csl!lhc!ncifcrf!haven!udel!wuarchive!mit-eddie!bloom-beacon!eru!hagbard!sunic!mcsun!hp4nl!sci.kun.nl!atcmpe!ronald
References: <297@twg.bc.ca>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!nih-csl!lhc!ncifcrf!haven!udel!wuarchive!mit-eddie!bloom-beacon!eru!hagbard!sunic!mcsun!hp4nl!sci.kun.nl!atcmpe!ronald
From: ronald@atcmp.nl (Ronald Pikkert)
Newsgroups: comp.unix.shell
Subject: Re: How to get AWK to output 2 fields at once
Message-ID: <678@atcmpe.atcmp.nl>
Date: 29 Oct 90 11:39:27 GMT
References: <297@twg.bc.ca>
Organization: AT Computing, Nijmegen, The Netherlands
Lines: 26