I have a text files in ascii format and wanted to replace a specific value by value saved in another text file.
consider a file of name text_1. . . . 50.asc
5 columns, 4 rows
sample data in a file
0.40007 0.544 0.6795 0.1545 -3.4028
0.61488 0.8471 0.7444 0.3537 0.0709
0.65128 0.6651 0.7948 0.9200 0.893
0.70952 0.5990 0.5061 0.610 0.893
And I wanted to replace (5th column, 1st row) of each file by value same in Replacing_values.txt
.
It have data
1
2
3
4
.
.
.
50
Expected result (continued to all files)
0.40007 0.544 0.6795 0.1545 1
0.61488 0.8471 0.7444 0.3537 0.0709
0.65128 0.6651 0.7948 0.9200 0.893
0.70952 0.5990 0.5061 0.610 0.893
I have tried this
for i in `seq 50`; do x=`awk 'FNR==(1) {print $5}' *.asc`; y=`cat Replacing_values.txt`; echo $x==$y ;done
echo $x==$y
?