Hi experts,
In my text file I have the following alot of lines like below.
input.k is as follows.
2684717 -194.7050476 64.2345581 150.6500092 0 0
2684718 -213.1575623 62.7032242 150.6500092 0 0
*INCLUDE
$# filename
./meshes/exportneu/147.k
*END
mesh.k is as follows
100
or any other 3 digit number
I want to replace the 147.k of this input.k to another number from
another file mesh.k which is 100 in this case..
Required output is as follows
2684717 -194.7050476 64.2345581 150.6500092 0 0
2684718 -213.1575623 62.7032242 150.6500092 0 0
*INCLUDE
$# filename
../meshes/exportneu/100.k
*END
I used
sed '/\<meshes\>/!d;=;s/.* ([^ ]\+).*/\1/;R mesh.k' input.k |
sed 'N;N;s|\n|s/|;s|\n|/|;s|$|/|;q' >temp.sed
sed -i -f temp.sed input.k
The point is that I want to replace this
is written in another file mesh.k , like in the other file only 100 is present or it could be 3 digit anyother number.
i know it can work with searching the line with word meshes for example and the dividing with last / and piping the data from other file but am not able to formulate the sed or awk.
I hope now you people understand what I mean. regards