Re: How to read a two columns file (461 Views)
Reply
Occasional Advisor
Posts: 8
Registered: ‎10-21-2011
Message 1 of 4 (488 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,111
Registered: ‎02-23-2005
Message 2 of 4 (466 Views)

Re: How to read a two columns file

Acclaimed Contributor
Posts: 25,529
Registered: ‎03-06-2006
Message 3 of 4 (461 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 (439 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.