On Sat, 27 Nov 2004 10:15:06 -0500, Anthony E. Greene wrote > >On Fri, 26 Nov 2004 19:27:09 -0500, Anthony E. Greene wrote > >> You could get fancy using perl's formatting features, but this quick$ > >> dirty should work for lines that are all of similar length, or for input > >> in an application that easily parses tab-delimited data. > > > > Uh... I forgot to increment the column number. > > print "$line "; > > prints the variable and a tab, not the variable and 5 spaces. A straight > copy/paste frome the message may have resulted in spaces rather than > a tab. Gotcha. Of course, this does not line up the columns, but (as you originally said), could be input into something that processes tab delimited columns. #!/usr/bin/perl # # Format STDIN into three tab-delimited columns # $colnum = 1; while ($line = <STDIN>) { chomp $line; if ($colnum < 3) { print "$line "; # The whitespace is a tab character. $colnum = $colnum + 1; } else { print "$line\n"; $colnum = 1; } } Thanks again. -- redhat-list mailing list unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe https://www.redhat.com/mailman/listinfo/redhat-list