Solved

sorting output with tab spaces rather than commas

Posted on 2009-07-07
8
185 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:Europa MacDonald
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Closing Comment

by:Europa MacDonald
ID: 31600516
thankyou
0
 
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:Europa MacDonald
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…
Six Sigma Control Plans

705 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