I have a data file with two columns of numbers:input file4.182   4.18434.184   4.26484.2281  4.08194.2204  4.16764.0482  4.16834.0156  4.28954.4504  5.23694.3776  4.49794.3797  4.13724.1411  4.0528I need to insert one column of numbers evenly spaced to the input data file. For example, in the output were inserted a column of numbers spaced by 5. ,so the numbers are 1 , 6, 11,16 , and so onoutput1   4.182   4.18436   4.184   4.264811  4.2281  4.081916  4.2204  4.167621  4.0482  4.168326  4.0156  4.289531  4.4504  5.236936  4.3776  4.497941  4.3797  4.137246  4.1411  4.0528
How to add a column of numbers to a array data file
shell script;shell;awk;sed
If I understand your index generation correctly, thenawk '{print 5*(NR-1)+1 $0}' yourfile > oufileshould do it. If you want prettier output, you can use printf instead e.g.$ awk '{printf %-3d %s\n, 5*(NR-1)+1, $0}' yourfile1   4.184   4.26486   4.2281  4.081911  4.2204  4.167616  4.0482  4.168321  4.0156  4.289526  4.4504  5.236931  4.3776  4.497936  4.3797  4.137241  4.1411  4.0528