Computing.Net > Forums > Unix > Using AWK

Using AWK

Reply to Message Icon

Original Message
Name: thoppz
Date: November 22, 2004 at 06:27:46 Pacific
Subject: Using AWK
OS: hp-ux 11.0
CPU/Ram: 1G
Comment:

I've a loop to read a file line by line.
Now each line has 4 columns seperated by space.
How do I get 4 diff column values using awk to 4 seperate variables?
eg of a line: adas 343434 adas@adas.org Informationsystems

n=`wc -l < get_dwsdid.txt`
i=1

while [ "$i" -le "$n" ]
do
line=`cat get_dwsdid.txt | head -$i | tail -1`

echo $line
i=`expr $i + 1`

done


Report Offensive Message For Removal


Response Number 1
Name: nails
Date: November 22, 2004 at 11:46:05 Pacific
Reply: (edit)

Sam:

Jim and I already answered this question last week. You may not like the answers, but I doubt asking the question again will get you any different input.



Report Offensive Follow Up For Removal

Response Number 2
Name: thoppz
Date: November 22, 2004 at 12:33:41 Pacific
Reply: (edit)

hi all,
The second posting was a mistake..I tried both your suggestions and it just worked great!!

Thanks a bunch.
Sam.


Report Offensive Follow Up For Removal

Response Number 3
Name: nails
Date: November 22, 2004 at 13:46:36 Pacific
Reply: (edit)

Sam:

You're welcome.


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Using AWK

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes In 5 Days.
Discuss in The Lounge