Solved

sorting output with tab spaces rather than commas

Posted on 2009-07-07
8
181 Views
Last Modified: 2012-05-07
is it possible to delineate output with tab spaces rather than using commas
eg
322,345,432,455,655,677,899,540 to        322    345   432   455   655   677   899   540  

I am using this code :

print OUT "$n1,$n2,$n3,$n4,$n5,$n6,$n7,",(floor $avg),"\n";
0
Comment
Question by:MichaelGlancy
  • 5
  • 2
8 Comments
 
LVL 9

Accepted Solution

by:
Suhas . earned 500 total points
ID: 24792592
replace the commas with \t to get the tabbed output

print OUT "$n1\t$n2\t$n3\t$n4\t$n5\t$n6\t$n7\t",(floor $avg),"\n";
0
 
LVL 84

Expert Comment

by:ozo
ID: 24792609
print join("\t",$n1,$n2,$n3,$n4,$n5,$n6,$n7,floor $avg),"\n"';
print join(",",$n1,$n2,$n3,$n4,$n5,$n6,$n7,floor $avg),"\n"';
0
 
LVL 84

Expert Comment

by:ozo
ID: 24792619
$, = "\t";
print $n1,$n2,$n3,$n4,$n5,$n6,$n7,floor $avg;
$, = ",";
print $n1,$n2,$n3,$n4,$n5,$n6,$n7,floor $avg;
0
 

Author Closing Comment

by:MichaelGlancy
ID: 31600516
thankyou
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 84

Expert Comment

by:ozo
ID: 24792629
#print join("\t",$n1,$n2,$n3,$n4,$n5,$n6,$n7,floor $avg),"\n"';
#print join(",",$n1,$n2,$n3,$n4,$n5,$n6,$n7,floor $avg),"\n"';
#sorry, I left an extra character in
print join("\t",$n1,$n2,$n3,$n4,$n5,$n6,$n7,floor $avg),"\n";
#and
print join("\t",$n1,$n2,$n3,$n4,$n5,$n6,$n7,floor $avg),"\n";
0
 

Author Comment

by:MichaelGlancy
ID: 24792634
print join . . .

doesnt seem to want to work
0
 
LVL 84

Expert Comment

by:ozo
ID: 24792635
print join("\t",$n1,$n2,$n3,$n4,$n5,$n6,$n7,floor $avg),"\n";
#and
print join(",",$n1,$n2,$n3,$n4,$n5,$n6,$n7,floor $avg),"\n";
0
 
LVL 84

Expert Comment

by:ozo
ID: 24792648
You could also replace the commas with tabs, but in a comment, it's difficult to distinguish tabs from spaces
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now