The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 01:22 PM
Using 'sed' to delete or ignore columns in a dataset aarif UNIX for Dummies Questions & Answers 0 02-29-2008 01:21 PM
Row to Columns vskr72 UNIX for Dummies Questions & Answers 4 03-21-2007 09:53 AM
How can I use columns with a command? chrchcol Shell Programming and Scripting 0 07-24-2006 08:51 PM
add columns with awk tonet Shell Programming and Scripting 4 06-21-2005 04:02 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-15-2007
su_in99 su_in99 is offline
Registered User
  
 

Join Date: Mar 2007
Posts: 21
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
  #2 (permalink)  
Old 05-15-2007
Shell_Life's Avatar
Shell_Life Shell_Life is offline
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
  #3 (permalink)  
Old 05-15-2007
su_in99 su_in99 is offline
Registered User
  
 

Join Date: Mar 2007
Posts: 21
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
  #4 (permalink)  
Old 05-15-2007
Shell_Life's Avatar
Shell_Life Shell_Life is offline
Registered User
  
 

Join Date: Mar 2007
Location: Bahia, Brazil
Posts: 695
Here it is:
Code:
cut -d' ' -f1,14 input_file > output_file
  #5 (permalink)  
Old 05-15-2007
su_in99 su_in99 is offline
Registered User
  
 

Join Date: Mar 2007
Posts: 21
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
  #6 (permalink)  
Old 05-15-2007
Shell_Life's Avatar
Shell_Life Shell_Life is offline
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.
  #7 (permalink)  
Old 05-16-2007
anbu23 anbu23 is offline Forum Advisor  
Registered User
  
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,398
Quote:
Originally Posted by su_in99
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
Code:
awk ' { print $1,$NF } ' filename
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:04 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0