![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| 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 !! |
|
|
||||
| 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 |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
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 |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
su,
See if this would work for you: Code:
cut -d' ' -f1,14 input_file |
|
#3
|
|||
|
|||
|
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
|
||||
|
||||
|
Here it is:
Code:
cut -d' ' -f1,14 input_file > output_file |
|
#5
|
|||
|
|||
|
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
|
||||
|
||||
|
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
|
|||
|
|||
|
Thank you very for your code.
|
|||
| Google The UNIX and Linux Forums |