How compute trend using awk?
问题 I have a time series of temperature data as: ifile.txt 1921 25 1922 25.1 1923 24.2 1924 23.4 1925 24.4 1926 25.1 1927 23.6 1928 25.2 1929 23.9 1930 25.6 I would like to compute the trend for the period 1923-1929. My algorithm to do it is: Fit the above points to a line such as Y = mX + c ; where m is the trend I could find the trend for whole period, but I can't able to modify my script when selecting for a specific period. Would you please check my script? awk '/1923/,/1929/ {if (NR==FNR) x