Go Back   SEQanswers > Bioinformatics > Bioinformatics

Similar Threads
Thread Thread Starter Forum Replies Last Post
text file editing Liy General 1 06-20-2015 12:29 PM
awk script to print a set of target sequences to same file MoGo Bioinformatics 1 04-27-2015 12:56 PM
Splitting the fasta file into 2 columns dena.dinesh Bioinformatics 2 02-24-2015 03:51 AM
convert a text file in fasta with decollpasing Giorgio C Bioinformatics 3 03-29-2013 10:48 AM
Text file editing_perl-GFF bioman1 Bioinformatics 0 07-05-2012 08:47 AM

Thread Tools
Old 10-17-2017, 12:18 PM   #1
Location: EU

Join Date: Jun 2011
Posts: 13
Default Print selected columns from a text file

[I have already found the answer, see below]

Hi all,

I am looking for a simple oneliner (preferably) to print only selected columns (given by their column numbers) from a tab separated text file. Could you please suggest a command?



awk -v OFS='\t' '{ print $1, $2, $4 }' old_file> new_file

Last edited by __sequence; 10-17-2017 at 01:07 PM. Reason: solved
__sequence is offline   Reply With Quote
Old 10-17-2017, 04:29 PM   #2
Location: MA, USA

Join Date: Feb 2014
Posts: 58

You could also consider:

cut -f 1,2,4 old_file > new_file
neavemj is offline   Reply With Quote

Thread Tools

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

All times are GMT -8. The time now is 07:52 AM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO