Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

File1:

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

File2:

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

I have more than 100 lines in file1 and I want the output as file2.

share|improve this question
    
I have tried using cut command but unable to produce the desired result. Then I have tried cat file1 | awk {printf $1,$3,$4,$5,$6,$7,$8,$10}. @John –  pmaipmui Jun 29 at 14:07
    
just change printf with print. Also cat is redundant. –  taliezin Jun 29 at 14:11

1 Answer 1

up vote 4 down vote accepted

The following command yields the requested output:

cut -d ' ' -f 1,3-10 file1
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.