I have a data file of two columns (corresponding to the x and y axes of a graph) separated by a comma. I want to find the local maximum values and print them to a file. It has been a while since I've done any scripting and I've forgotten everything. I have a few basic questions.
1.) How do you read a file into a script? I know how to set a variable as a file and to access the file, I just can't recall how to make the file itself a variable to be read into the script.
2.) One a file is set to a specific variable name, how do I access a specific element? (i.e. row and column)
For instance, if I have a file 'data' with composed of the following:
12 23
15 49
19 22
20 12
34 39
45 1
60 56
89 79
I want a to make a file with
15 49
34 39
89 79
but I'm just having trouble remembering how to access the specific elements. i.e. the second column first element.
Any help or direction towards a good resource would be greatly appreciated. Thank you.
-John