bob wrote:
Hello

Hello,

I am very new to perl and I need some guidance on the following issue

My data set is like this

---------------------------
Record 38
Richard Nixon
http://en.wikipedia.org/wiki/Richard_Nixon
---------------------------
Record 39
Gerald Ford
http://en.wikipedia.org/wiki/Gerald_Ford
---------------------------
Record 40
Jimmy Carter
http://en.wikipedia.org/wiki/Jimmy_Carter

and I would like to print it out like

Record 38 \t Richard Nixon \t http://en.wikipedia.org/wiki/Richard_Nixon
Record 39 \t Gerald Ford \t http://en.wikipedia.org/wiki/Gerald_Ford
Record 40 \t Jimmy Carter \t http://en.wikipedia.org/wiki/Jimmy_Carter


$ echo "---------------------------
Record 38
Richard Nixon
http://en.wikipedia.org/wiki/Richard_Nixon
---------------------------
Record 39
Gerald Ford
http://en.wikipedia.org/wiki/Gerald_Ford
---------------------------
Record 40
Jimmy Carter
http://en.wikipedia.org/wiki/Jimmy_Carter
" | perl -e'

$/ = ( "-" x 27 ) . "\n";
$\ = "\n";

while ( <> ) {
    chomp;
    tr/\n/\t/;
    print;
    }
'

Record 38       Richard Nixon   http://en.wikipedia.org/wiki/Richard_Nixon
Record 39       Gerald Ford     http://en.wikipedia.org/wiki/Gerald_Ford
Record 40       Jimmy Carter    http://en.wikipedia.org/wiki/Jimmy_Carter



John
--
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction.                   -- Albert Einstein

--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/


Reply via email to