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

Re: How to read a two columns file

Acclaimed Contributor
Dennis Handly
Posts: 25,303
Registered: ‎03-06-2006
Message 3 of 4 (456 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
SwissKnife
Posts: 8
Registered: ‎10-21-2011
Message 4 of 4 (434 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.