
다음과 같은 두 개의 파일이 있습니다.
파일 1:
a stringori to replace, this stringori comme again
other stringori2 to replace, stringori2 commes again
...
파일 2:
stringori newstring
stringori2 newstring2
...
결과를 얻고 싶습니다.
a newstring to replace, this newstring comme again
other newstring2 to replace, newstring2 commes again
답변1
나는 이 질문이 이 포럼에서 수없이 해결/답변되었다고 확신합니다. 어때요?
awk 'NR == FNR {T[$1] = $2; next} {for (t in T) gsub (t, T[t])} 1' file2 file1
a newstring to replace, this newstring comme again
other newstring2 to replace, newstring2 commes again