|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | 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 Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Cut the two column from non delimited file
Hi, I have a question how to cut the column from non delimited file This is my file Code:
gene_id ENSG00000223972 transcript_id ENST00000456328 exon_number 1 gene_biotype pseudogene gene_name DDX11L1 transcript_name DDX11L1-002 tss_id TSS26614 gene_id ENSG00000223972 transcript_id ENST00000515242 exon_number 1 gene_biotype pseudogene gene_name DDX11L1 transcript_name DDX11L1-201 tss_id TSS165962 gene_id ENSG00000223972 transcript_id ENST00000518655 exon_number 1 gene_biotype pseudogene gene_name DDX11L1 transcript_name DDX11L1-202 tss_id TSS165964 gene_id ENSG00000223972 transcript_id ENST00000450305 exon_number 1 gene_biotype pseudogene gene_name DDX11L1 transcript_name DDX11L1-001 tss_id TSS72060 gene_id ENSG00000223972 transcript_id ENST00000450305 exon_number 2 gene_biotype pseudogene gene_name DDX11L1 transcript_name DDX11L1-001 tss_id TSS72060 gene_id ENSG00000223972 transcript_id ENST00000518655 exon_number 2 gene_biotype pseudogene gene_name DDX11L1 transcript_name DDX11L1-202 tss_id TSS165964 I want to cut only the 1st and 2nd column (gene_id, ENST#) Thank you Last edited by Scrutinizer; 01-15-2013 at 07:52 AM.. Reason: quote tags => code tags |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
If the fields are separated by a single space, then: Code:
cut -d" " -f1-2 file Otherwise it's simple with awk Code:
awk '{print $1 FS $2}' fileI would add that this kind of question has been asked very many times, and you should search before asking. Thanks. |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to show particular column from pipe delimited file | vai15517 | Homework & Coursework Questions | 1 | 05-07-2012 09:31 AM |
| Moving a column across a delimited data file | ayan153 | Shell Programming and Scripting | 2 | 10-09-2011 10:47 AM |
| Extract second column tab delimited file | shoaibjameel123 | Shell Programming and Scripting | 1 | 09-09-2011 05:28 AM |
| Changing one column of delimited file column to fixed width column | manneni prakash | Shell Programming and Scripting | 5 | 06-22-2009 05:27 AM |
| To cut entire column from a file and apend it to another file as another column | sakthifire | Shell Programming and Scripting | 4 | 06-25-2008 04:27 AM |
|
|