Re: How to read a two columns file (460 Views)
Reply
Occasional Advisor
Posts: 8
Registered: ‎10-21-2011
Message 1 of 4 (487 Views)
Accepted Solution

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.

Honored Contributor
Posts: 9,109
Registered: ‎02-23-2005
Message 2 of 4 (465 Views)

Re: How to read a two columns file

Acclaimed Contributor
Posts: 25,436
Registered: ‎03-06-2006
Message 3 of 4 (460 Views)

Re: How to read a two columns file

[ Edited ]

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.

Occasional Advisor
Posts: 8
Registered: ‎10-21-2011
Message 4 of 4 (438 Views)

Re: How to read a two columns file

Thank you!

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.