I'm trying to make an script that replaces lines that starts with a pattern given by the lines of other file.
Example lines of the base file:
Code:
& NAME 1
UH 24 1 26.03 1
& NAME 2
UH 27 1 50.05 1
Example lines of the input file:
Code:
UH 24 1 27.68 1
UH 27 1 37.21 1
I just want the script to replace the values (i.ex: 26.03 for 27.68).
I've made the script below but the sed doesn't work.
Code:
while IFS= read -r line
do
pattern=${line:0:15}
sed "s/$pattern.*/$line/" BASE.TXT > OUTPUT.TXT
done < INPUT.TXT
Thanks in advance!