쉘 명령을 사용하여 행에서 특정 필드를 추출하는 방법은 무엇입니까?

쉘 명령을 사용하여 행에서 특정 필드를 추출하는 방법은 무엇입니까?

파일 1:

27/07/2014 10.10.03 Breaker1 was closed by Mr. A.Basu Spectrum ui6dms
29/07/2014 04.50.53 Breaker1 was opened by Mr. D.Gupta Spectrum ui6dms and one note added
30/08/2014 03.20.01 EarthSwitch was closed by Mr. K.Saha Spectrum ui1dms
01/09/2014 08.10.39 EarthIsolator was closed by Mr. R.Das Spectrum ui3dms

파일 2:

27/07/2014 Breaker1 was closed by Mr. A.Basu ui6dms
29/07/2014 Breaker1 was opened by Mr. D.Gupta ui6dms
30/08/2014 EarthSwitch was closed by Mr. K.Saha ui1dms
01/09/2014 EarthIsolator was closed by Mr. R.Das ui3dms

file1에 100줄이 넘는 줄이 있고 출력을 file2로 만들고 싶습니다.

답변1

다음 명령은 요청된 출력을 생성합니다.

cut -d ' ' -f 1,3-10 file1

관련 정보