Solved

sorting output with tab spaces rather than commas

Posted on 2009-07-07
8
182 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Closing Comment

by:MichaelGlancy
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: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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
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…

832 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