Search Results

Search: Posts Made By: Jikuu
1,580
Posted By Jikuu
Thanks for the help. Much appreciated.
Thanks for the help. Much appreciated.
1,580
Posted By Jikuu
and if i wanted multiple variables? VAR1=Bob...
and if i wanted multiple variables?

VAR1=Bob
VAR2=Steve

awk -v VAR1=$VAR1 VAR2=$VAR2 '($3 == VAR1 && $4 == VAR2) { print $1 }' file.txt

I know the '($3 == VAR1 && $4 == VAR2)' bit is right...
1,580
Posted By Jikuu
awk comparing variables
Is there a way to compare variables in a 'awk'?
I've been trying for a while and can't figure it out. I'm guessing its not possible :/

VAR=Bob
awk '$3 == $VAR { print $1 }' file.txt

Regards...
Showing results 1 to 3 of 3

 
All times are GMT -4. The time now is 09:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy