![텍스트 파일의 데이터 바꾸기 [닫기]](https://linux55.com/image/97388/%ED%85%8D%EC%8A%A4%ED%8A%B8%20%ED%8C%8C%EC%9D%BC%EC%9D%98%20%EB%8D%B0%EC%9D%B4%ED%84%B0%20%EB%B0%94%EA%BE%B8%EA%B8%B0%20%5B%EB%8B%AB%EA%B8%B0%5D.png)
파일이 두 개 있어요
파일 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