The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Using 'sed' to delete or ignore columns in a dataset aarif UNIX for Dummies Questions & Answers 4 07-21-2008 09:22 AM
Using 'sed' to delete or ignore columns in a dataset aarif UNIX for Dummies Questions & Answers 0 02-29-2008 10:21 AM
Row to Columns vskr72 UNIX for Dummies Questions & Answers 4 03-21-2007 06:53 AM
How can I use columns with a command? chrchcol Shell Programming and Scripting 0 07-24-2006 04:51 PM
add columns with awk tonet Shell Programming and Scripting 4 06-21-2005 12:02 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 05-15-2007
Registered User
 

Join Date: Mar 2007
Posts: 17
delete some columns

I've got a data file like the following format.

196004010000 196004020000 8192 24 ueaag 98.793 18.750 20 ---- - 36 23 9999 314.161773681641
196004020000 196004030000 8192 24 ueaag 98.793 18.750 20 ---- - 36 23 9999 314.71533203125
196004030000 196004040000 8192 24 ueaag 98.793 18.750 20 ---- - 36 23 9999 315.208740234375

I need the first and last column as

196004010000 314.161773681641
196004020000 314.71533203125
196004030000 315.208740234375

Would you have any idea to do this job? I'd be grateful with any help.

Many thanks,
su_in99
Reply With Quote
Forum Sponsor
  #2  
Old 05-15-2007
Shell_Life's Avatar
Registered User
 

Join Date: Mar 2007
Location: Bahia, Brazil
Posts: 695
su,
See if this would work for you:
Code:
cut -d' ' -f1,14 input_file
Reply With Quote
  #3  
Old 05-15-2007
Registered User
 

Join Date: Mar 2007
Posts: 17
Thank you for your quick reply.

But If I would like to save the new file, could you please tell me?

Many thanks indeed

su_in99
Reply With Quote
  #4  
Old 05-15-2007
Shell_Life's Avatar
Registered User
 

Join Date: Mar 2007
Location: Bahia, Brazil
Posts: 695
Here it is:
Code:
cut -d' ' -f1,14 input_file > output_file
Reply With Quote
  #5  
Old 05-15-2007
Registered User
 

Join Date: Mar 2007
Posts: 17
sorry but I've got the wrong column. I need the first and last column.

196004010000 18.750
196004010000 18.750
196004010000 18.750

Many thanks,
S
Reply With Quote
  #6  
Old 05-15-2007
Shell_Life's Avatar
Registered User
 

Join Date: Mar 2007
Location: Bahia, Brazil
Posts: 695
su,
The solution I gave to you does work with the sample data you gave here.
You must be not be using exactly the solution I purposed or you are using
a different file layout from what is here.
Reply With Quote
  #7  
Old 05-15-2007
Registered User
 

Join Date: Mar 2007
Posts: 17
Thank you very for your code.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 12:19 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0