Vim - 점 뒤의 공백을 개행 문자로 바꾸는 방법은 무엇입니까?

Vim - 점 뒤의 공백을 개행 문자로 바꾸는 방법은 무엇입니까?

웹의 일부 텍스트를 Vim 편집기에 붙여넣었는데 어떤 이유로 각 단락이 한 줄로 처리됩니다.

PROD $ egrep -i 'system' text
Hurricane Dorian is a strong tropical cyclone currently affecting the Bahamas and the Southeastern United States. The fourth named storm, second hurricane, and first major hurricane of the 2019 Atlantic hurricane season, Dorian developed from a tropical wave on August 24 in the Central Atlantic. The system gradually intensified while moving toward the Lesser Antilles, before becoming a hurricane on August 28. Rapid intensification ensued, and on August 31, Dorian intensified into a Category 4 major hurricane. On the following day, Dorian reached Category 5 intensity, peaking with one-minute sustained winds of 185 mph (295 km/h) and a minimum central pressure of 910 millibars (26.87 inHg) while making landfall in Elbow Cay, Bahamas, at 16:40 UTC. Dorian made another landfall on Grand Bahama several hours later, near the same intensity.

각 문장이 한 줄로 처리되도록 붙여넣은 텍스트의 형식을 다시 지정하고 싶습니다. 또한 문장 끝에 "."을 유지하고 싶습니다. Vim에서 어떻게 할 수 있나요? 아니면 붙여넣은 단락이 애초에 한 줄로 처리되는 것을 방지하는 방법은 무엇입니까?

:%s/. /\n/g작동하지 않습니다. 작동하더라도 점과 공백을 개행 문자로 바꾸지만 각 문장 끝에 점을 유지하고 싶습니다.

감사해요

답변1

:%s/. /\n/g거의 비슷하지만 세 가지 오류가 있습니다.

  • .모든 문자와 일치합니다. 실제 포인트를 일치시키려면 이스케이프 처리하세요.\.
  • 점을 유지하려면 대체 문자열에 넣으십시오 (다소 명백한)
  • \n널 문자입니다. \r개행 문자의 경우

그 결과는 다음과 같습니다.

:%s/\. /.\r/g

관련 정보