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

 
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.

Highlighted
SwissKnife
Advisor

Re: How to read a two columns file

Thank you!