Solved

sorting output with tab spaces rather than commas

Posted on 2009-07-07
8
183 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

Title # Comments Views Activity
perl search and replace 6 171
Port 80 requests 16 100
Executing multiple sybase statements in perl dbi 2 94
perl getopt long help 34 71
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
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…

831 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