Use cut output as variable piped awk command

Hi,

I would like use the output of my cut command as a variable in my following awk command. Here's what I've written.

cut -f1 info.txt | awk -v i=xargs -F'[\t]' '{if($6 == $i) print $20}' summary.txt

Where obviously the 'xargs' doesn't do what I want. How can I pass my cut result to my awk statement. I'm trying to avoid writing a shell script. There must be a way to do this. Maybe the varaible is represented by somesort of builtin variable???

Thanks!

Showing us a command that does not work without explaining what you do want gives us no information that we can use to figure out what is going wrong.

But, since the default field separator for cut is a <tab> character and you're only extracting the first input field from info.txt to be fed into your awk script, it is obvious that the 6th and 20th fields in the input that awk is reading will ALWAYS be empty strings. And, since the string xargs is not a numeric string, the string specified by $i will either be treated as a synonym for $0 or treated as a syntax error. (And, since you haven't bothered to tell us what operating system or shell you're using, there isn't any way that we can test what might happen on your system!)

If you'd like to give us a sample input file, a specification of what you're trying to accomplish, the output that you hope to produce from your sample input file, and tell us what operating system and shell you're using, we might be able to help you accomplish your goal.

Oops! I take it back. Since you're giving awk the name of a file to process, the cut command output will be completely ignore by awk .

Geez nevermind. I thought the command was simple enough.

Yes. You have two simple commands connected into a single pipeline that clearly is not doing what you intended it to do.

Given that only you know what it is that you're trying to do and the pipeline you're using is not doing that, why is it so unreasonable for me to ask you to tell us what you are trying to do?