Simpler Navigation for Servers and Operating Systems
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
Languages and Scripting
cancel
Showing results for 
Search instead for 
Did you mean: 

How to read a two columns file

SOLVED
Go to solution
SwissKnife
Advisor

How to read a two columns file

Hi,

 

I need something like that:

Read a file having 2 columns and provide a specific compute on each column.

 

If I schematize the idea it could be like this.

 

For each line of the text file

 -> call a function with value in column one

 -> doing something else with the column two

....

 

Thanks in advance,

Den.

3 REPLIES
Steven Schweda
Honored Contributor
Solution

Re: How to read a two columns file

 
Highlighted
Dennis Handly
Acclaimed Contributor

Re: How to read a two columns file

Besides Steven's "while read", you can use awk's fields, $1 & $2.  Of course you could need to write your function in awk, possibly using system to invoke a script.

SwissKnife
Advisor

Re: How to read a two columns file

Thank you!