replacing one line with other

Hello

i need little help.

i have 2 files.

first that contains a lot of data and about 2000 lines that i need to replace with new ones. Lets call that line A.

i know exactly how that lines looks.

in second file i have about 2000 lines which contains the line A and line B in same line separated by ';'.

line B is the new value.

so i need a way how to go through first file and if i find value A that corresponds to value A from second file to replace it with value B from that same line.

if anyone has any idea please help.

e.g.

first file

ADSE 333 333 333 4.5.6 333.3

second file

ADSE 333 333 333 4.5.6 333.3 ;ADSE 222 333 222 4.5.6 345.1

result should be

ADSE 222 333 222 4.5.6 345.1

Try:

grep -f file1 file2 | sed 's/^.* ;//g'

Explanation:

grep -f file1 file2             # this should display all lines of file2 which contains a part of file1
sed 's/^.* ;//g'             # this will remove characters from starting until it encounters ;(comma)

yes but i need the line from file 1 to be exchnaged by value from file 2 after the ';' in the file 1

first file

ADSE 333 333 333 4.5.6 333.3

second file

ADSE 333 333 333 4.5.6 333.3 ;ADSE 222 333 222 4.5.6 345.1

result should be in file 1

ADSE 222 333 222 4.5.6 345.1