![데이터를 Excel로 형식 지정 [닫기]](https://linux55.com/image/187328/%EB%8D%B0%EC%9D%B4%ED%84%B0%EB%A5%BC%20Excel%EB%A1%9C%20%ED%98%95%EC%8B%9D%20%EC%A7%80%EC%A0%95%20%5B%EB%8B%AB%EA%B8%B0%5D.png)
txt 파일로 다음과 같은 형식의 많은 양의 데이터가 있습니다. 보시다시피 각 행에는 헤더와 경로가 있습니다. 여기서 필요한 것은 Excel에서 제목:경로와 같이 데이터가 서로 옆에 표시되어야 한다는 것입니다.
누구든지 이 문제에 대해 도움을 줄 수 있나요?
현재 결과
Title:Projects and Ideas
Path:/content/en_us/
Title:buying-guide
Path:/content/en_us/buying-guide
Title:Choose Exterior Paint Colors
Path:/content/en_us/buying-guide/choose-exterior-paint-colors
Title:Water Softener Buying Guide
Path:/content/en_us/buying-guide/water-softener-buying-guide
Title:Presentation Page
Path:/content/en_us/buying-guide/presentation-page
예상되는 결과
Title:Projects and Ideas Path:/content/en_us/
Title:buying-guide Path:/content/en_us/buying-guide
Title:Choose Exterior Paint Colors Path:/content/en_us/buyingguide/choose
Title:Water Softener Buying Guide Path:/content/en_us/buying-guide/water
Title:Presentation Page Path:/content/en_us/buying-guide/presentation-page
답변1
파일 탭을 분리하여 테이블로 붙여넣기를 원한다고 가정합니다. 그래서 당신은 이것을 할 수 있습니다 :
$ sed 'N;s/\n\(Path.*\)$/\t\1/' file
Title:Projects and Ideas Path:/content/en_us/
Title:buying-guide Path:/content/en_us/buying-guide
Title:Choose Exterior Paint Colors Path:/content/en_us/buying-guide/choose-exterior-paint-colors
Title:Water Softener Buying Guide Path:/content/en_us/buying-guide/water-softener-buying-guide
Title:Presentation Page Path:/content/en_us/buying-guide/presentation-page
Excel은 Unix/Linux가 아니지만 LibreOfiice Calc와 같은 Linux에서 사용할 수 있는 사무용 소프트웨어에도 동일한 질문이 적용되므로 제 대답입니다.