LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   help using awk (https://www.linuxquestions.org/questions/linux-newbie-8/help-using-awk-844885/)

ryme27 11-17-2010 12:33 PM

help using awk
 
I need a little help using awk.

Lets say file1 has

Office: 1 : 300
Home: 2 : 500
Retail: 3 : 100

file 2 has

2: Admin
2: Street
1: Avenue
3: Example

How do i set up awk so that it will choose the second column $2 and compare it the numbers in file 2 and display the which ones are similiar..For example when the user chooses number 2. then it would display 2:Admin and 2: Street

jf.argentino 11-17-2010 04:08 PM

What have you tried to do?

grail 11-17-2010 07:36 PM

I agree with jf that you need to show what you have tried and or failed at. The only hint I would give if using awk is to remember that you will read all of
file1 prior to reading the first line in file2.


All times are GMT -5. The time now is 01:22 AM.