Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^3: tabular format of data

by Anonymous Monk
on Feb 18, 2012 at 01:04 UTC ( [id://954658]=note: print w/replies, xml ) Need Help??


in reply to Re^2: tabular format of data
in thread tabular format of data

Sure, show your code

Replies are listed 'Best First'.
Re^4: tabular format of data
by deepak_4682us (Initiate) on Feb 18, 2012 at 01:14 UTC
    A.txt:- A:B C:D code: # it has column1 values of txt file @a1=`cut -d":" -f1 < A.txt; # it has column2 values of txt file @a2=`cut -d":" -f2 < A.txt; I wanted to reprent the values in tabular form

      eew , you're shelling out for cut

      Here is a oneliner

      perl -F: -lane " print qq/-------/ if 1==$.; print join q/|/, @F, qq// +; print q/--/ x @F, qq//; " < infile > outfile

      more verbosely written as

      BEGIN { $/ = "\n"; $\ = "\n"; } LINE: while (defined($_ = <ARGV>)) { chomp $_; our(@F) = split(/:/, $_, 0); print '-------' if 1 == $.; print join('|', @F, ''); print '--' x @F, ''; }
A reply falls below the community's threshold of quality. You may see it by logging in.
A reply falls below the community's threshold of quality. You may see it by logging in.
A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://954658]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-23 09:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found