CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
insert tab in awk command

 



cmccabe1
Novice

Oct 11, 2013, 8:22 AM

Post #1 of 2 (408 views)
insert tab in awk command Can't Post


Code
cat ensHuman.txt | awk {print $1,$2,$2,$4,$5,$3,$8} >cut_ensHuman.txt


Is it possible to output the data in 7 columns instead of all in one?

1 10144 10144 TA T rs144773400 dbSNP_137;TSA=deletion
1 10177 10177 A C rs201752861 dbSNP_137;TSA=SNV
1 10180 10180 T C rs201694901 dbSNP_137;TSA=SNV

A B C D E F G
1 10144 10144 TA T rs144773400 dbSNP_137;TSA=deletion

Thanks.


Laurent_R
Enthusiast / Moderator

Oct 12, 2013, 4:13 AM

Post #2 of 2 (402 views)
Re: [cmccabe1] insert tab in awk command [In reply to] Can't Post

Hmm, this is not a Perl question, but you might try the following.

Content of my test.txt file:


Code
$ cat test.txt 
1 10144 10144 TA T rs144773400 dbSNP_137;TSA=deletion
1 10177 10177 A C rs201752861 dbSNP_137;TSA=SNV
1 10180 10180 T C rs201694901 dbSNP_137;TSA=SNV


The awk command and the output:

Code
$ cat test.txt | awk '{print $1, "\t", $2, "\t", $3}' 
1 10144 10144
1 10177 10177
1 10180 10180


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives