Skip to main content
clarification
Source Link

I am not used to code, but for my work I have to do some processing with text-files and I need some help with a problem I encountered.

I have a file with two columns containing some numbers:

180.000000 115.944480 180.000000 95.979157 180.000000 93.583322 178.593750 122.797168 178.593750 120.000000 178.593750 117.279613 178.593750 102.024699 178.593750 99.594068 ... ... 

There are several values in the second column associated with one unique value in the first column. Now I want to calculateprint for every unique value in column 1 the interval of values in column 2.

Desired output:

22115.361158944480 93.583322 23122.2031797168 99.594068 ... 

Obviously I have to store the values and have to executeprint a calculationprevious and the recent value of column 2 if the value in column 1 changes. But that is the problem: How can this be realized in bash or awk?

I am not used to code, but for my work I have to do some processing with text-files and I need some help with a problem I encountered.

I have a file with two columns containing some numbers:

180.000000 115.944480 180.000000 95.979157 180.000000 93.583322 178.593750 122.797168 178.593750 120.000000 178.593750 117.279613 178.593750 102.024699 178.593750 99.594068 ... ... 

There are several values in the second column associated with one unique value in the first column. Now I want to calculate for every unique value in column 1 the interval of values in column 2.

Desired output:

22.361158 23.2031 ... 

Obviously I have to store the values and have to execute a calculation if the value in column 1 changes. But that is the problem: How can this be realized in bash or awk?

I am not used to code, but for my work I have to do some processing with text-files and I need some help with a problem I encountered.

I have a file with two columns containing some numbers:

180.000000 115.944480 180.000000 95.979157 180.000000 93.583322 178.593750 122.797168 178.593750 120.000000 178.593750 117.279613 178.593750 102.024699 178.593750 99.594068 ... ... 

There are several values in the second column associated with one unique value in the first column. Now I want to print for every unique value in column 1 the interval of values in column 2.

Desired output:

115.944480 93.583322 122.797168 99.594068 ... 

Obviously I have to store the values and have to print a previous and the recent value of column 2 if the value in column 1 changes. But that is the problem: How can this be realized in bash or awk?

Source Link

Calculate interval if value in column changes

I am not used to code, but for my work I have to do some processing with text-files and I need some help with a problem I encountered.

I have a file with two columns containing some numbers:

180.000000 115.944480 180.000000 95.979157 180.000000 93.583322 178.593750 122.797168 178.593750 120.000000 178.593750 117.279613 178.593750 102.024699 178.593750 99.594068 ... ... 

There are several values in the second column associated with one unique value in the first column. Now I want to calculate for every unique value in column 1 the interval of values in column 2.

Desired output:

22.361158 23.2031 ... 

Obviously I have to store the values and have to execute a calculation if the value in column 1 changes. But that is the problem: How can this be realized in bash or awk?