텍스트 파일의 데이터 바꾸기

텍스트 파일의 데이터 바꾸기

파일이 두 개 있어요

파일1:

 world,11

파일2:

hello welcome to the ("12345,67")

"(12345,67)"위의 내용을 다음으로 대체하려고합니다."world,11"

답변1

귀하가 게시한 내용에 따르면 이 코드가 귀하의 문제를 해결할 것이라고 생각합니다.

replacement=`cat replacement.txt`
content=`cat content.txt`
pattern="pattern"
echo "${content//$pattern/$replacement}" # all strings matching will be replaced with $replacement
echo "${content/$pattern/$replacement}" # the first string matching the pattern will be replaced

관련 정보