Skip to main content

All Questions

Tagged with
0 votes
2 answers
502 views

Remove and replace column

I have a file which looks like this: 1 1 2 5.24 3 12.46 4 21.56 and so on. I need to change it to: 1 1 3 5.24 5 12.46 7 21.56 on a quick way. So the first column has to have odd values 2i+1 for i ...
Giacomo's user avatar
  • 103
3 votes
1 answer
624 views

How can I calculate the average of multiple columns with the same value for the first two columns?

I have a file of about 13 million lines like: Lat Long air_temp sst wind_speed wave_height wave_period 65.3 7.3 4.3 8.8 7.7 4 8 61.6 1.3 -9.99 8.8 9.8 4 7 61.2 1.1 -9.99 8.8 7....
Roxana Radu's user avatar
2 votes
2 answers
226 views

Rearranging list of numbers to make a matrix

I am trying to write a script to change the following set of numbers 2.659980 3.256998 4.589778 2.120150 2.223365 2.325566 2.121112 3.020111 4.065112 0.221544 1.236665 1.395958 to the following ...
ankit7540's user avatar
  • 321
-2 votes
3 answers
884 views

how to create 2 columns with repeated sequence of values in linux?

I want to create a 2 columns like: 1 10 1 20 1 30 1 40 1 50 2 10 2 20 2 30 2 40 2 50 3 10 3 20 3 30 3 40 3 50 any suggestion please?
zara's user avatar
  • 1,333
2 votes
2 answers
592 views

average of specific rows in a file and output in tab-delimited file

I have 6 rows in files. I need to find average only of specific rows in a file and the others should be left as they are. The average should be calculated for A1 and A2, B1 and B2, other lines should ...
Anni's user avatar
  • 143
-1 votes
1 answer
738 views

Count of Lines within a Range

I'm trying to do a count of all the values (numeric) in the third column of a file that fall within a specific range of numbers. I've found the min and max but have no idea how to do the count now. I'...
Salma's user avatar
  • 1