The general alignment program align provides a feature for processing only lines on which patterns match:
producing:
The code for align can be obtained from the URL noted in the first part of the script.
Best wishes ... cheers, drl
Last edited by drl; 08-24-2014 at 02:27 PM..
Reason: Edit 1 - correct minor typo.
Howdy,
Supposing I want to output the following code to the screen in a bash script, this works fine until you use variables as below, because the variable could be of any length, meaning the screen output for line 2 will have the ultimate # out of alignment.
Is there a simple way round this?... (1 Reply)
Hi,
I have tcp/ip client server programs which will communicate through reqest,reply c-structures.
As the sizeof(struct) may give different value between client and server programs, how do i align properly for boundary conditions.
Could anybody please give some suggestion.
Thanks in... (3 Replies)
Hello,
Is there anyway that I can align a pipe delimited text file by the maxium field length where the field is separated out by pipes for large text files with more than
100,000 rows?
So, far I have searched other forums and google about aligning text files in unix and I have noticed that... (7 Replies)
Hi All,
I have two sets of files with names .dat and .txt. The number of files is really large more than 90000. The files have names like 1.dat, 2.dat,3.dat and so on where as txt files have names like 1.txt, 2.txt, 3.txt and so on
The DAT and TXT files are equal in number. About 90000 each
... (4 Replies)
Hi All,
I am new to perl and was trying to write a simple program which will generate a text file as output..
now the output which i am getting is something like this..
==================================================================================================
Col1 ... (8 Replies)
Hello friends
Please help me to display the content of a file in specific aligned manner.
for ex.
the content of the file may be
>$TEST
WELCOME
HI
HELLO
UNIX
SHELL
SCRIPTING
>$
I want to display the content like
.
TEST WELCOME HI
HELLO ... (18 Replies)
Hello Gurus !
I have what probably amounts to a few simply changes to fix; however for the life of me I cannot seem to get it ti work. I need to align the output of my script (I am writing to a logfile)... here's the lines in my code:
if
then
echo "NODE: $node" >> $logfile... (6 Replies)
Hi Guys,
How can you align data getting the UID, GID HOSTNAME in same column
input:
server1
uid=1010(faculty) gid=700(teacher) groups=700(teacher), 800(models)
student:x:500:500:student:/home/student:/bin/bash
server2
uid=1010(OSAD) gid=700(teacher) groups=700(teacher), 809(staff)... (5 Replies)
is there any way to align my text so every column begins on the same line as the previous line?
here's my command:
printf "THEN ( ${SEARCHPATTB} = Hour = ${CALTOTB} ) %8s => %8s NOW ( ${SEARCHPATT} = Hour = ${CALTOT} ) %7s => %7s Reduced By: %7s -${RESULT}"\\n
output i'm currently getting... (2 Replies)
Shell script logic
Hi
I have 2 input files like with file 1 content as (file1)
"BRGTEST-242" a.txt "BRGTEST-240" a.txt "BRGTEST-219" e.txt
File 2 contents as fle(2)
"BRGTEST-244" a.txt "BRGTEST-244" b.txt "BRGTEST-231" c.txt "BRGTEST-231" d.txt "BRGTEST-221" e.txt
I want to get... (22 Replies)
Discussion started by: pottic
22 Replies
LEARN ABOUT DEBIAN
gd::text::align
Text::Align(3pm) User Contributed Perl Documentation Text::Align(3pm)NAME
GD::Text::Align - Draw aligned strings
SYNOPSIS
use GD;
use GD::Text::Align;
my $gd = GD::Image->new(800,600);
# allocate colours, do other things.
my $align = GD::Text::Align->new($gd
valign => 'top',
halign => 'right',
);
$align->set_font('arial', 12);
$align->set_text('some string');
@bb = $align->bounding_box(200, 400, PI/3);
# you can do things based on the bounding box here
$align->draw(200, 400, PI/3);
DESCRIPTION
GD::Text::Align provides an object that draws a string aligned to a coordinate at an angle.
For builtin fonts only two angles are valid: 0 and PI/2. All other angles will be converted to one of these two.
METHODS
This class inherits everything from GD::Text. I will only discuss the methods and attributes here that are not discussed there, or that
have a different interface or behaviour. Methods directly inherited include "set_text" and "set_font".
GD::Text::Align->new($gd_object, attrib => value, ...)
Create a new object. The first argument to new has to be a valid GD::Image object. The other arguments will be passed on to the set method.
$align->set(attrib => value, ...)
Set an attribute. Valid attributes are the ones discussed in GD::Text and:
valign, halign
Vertical and horizontal alignment of the string. See also set_valign and set_halign.
colour, color
Synonyms. The colour to use to draw the string. This should be the index of the colour in the GD::Image object's palette. The default
value is the last colour in the GD object's palette at the time of the creation of $align.
$align->get(attribute)
Get the value of an attribute. Valid attributes are all the attributes mentioned in GD::Text, the attributes mentioned under the "set"
method and
x, y and angle
The x and y coordinate and the angle to be used. You can only do this after a call to the draw or bounding_box methods. Note that these
coordinates are not necessarily the same ones that were passed in. Instead, they are the coordinates from where the GD methods will
start drawing. I doubt that this is very useful to anyone.
Note that while you can set the colour with both 'color' and 'colour', you can only get it as 'colour'. Sorry, but such is life in
Australia.
$align->set_valign(value)
Set the vertical alignment of the string to one of 'top', 'center', 'base' or 'bottom'. For builtin fonts the last two are the same. The
value 'base' denotes the baseline of a TrueType font. Returns true on success, false on failure.
$align->set_halign(value)
Set the horizontal alignment of the string to one of 'left', 'center', or 'right'. Returns true on success, false on failure.
$align->set_align(valign, halign)
Set the vertical and horizontal alignment. Just here for convenience. See also "set_valign" and "set_halign". Returns true on success,
false on failure.
$align->draw(x, y, angle)
Draw the string at coordinates x, y at an angle angle in radians. The x and y coordinate become the pivot around which the string rotates.
Note that for the builtin GD fonts the only two valid angles are 0 and PI/2.
Returns the bounding box of the drawn string (see "bounding_box()").
$align->bounding_box(x, y, angle)
Return the bounding box of the string to draw. This returns an eight-element list (exactly like the GD::Image->stringTTF method):
(x1,y1) lower left corner
(x2,y2) lower right corner
(x3,y3) upper right corner
(x4,y4) upper left corner
Note that upper, lower, left and right are relative to the string, not to the canvas.
The bounding box can be used to make decisions about whether to move the string or change the font size prior to actually drawing the
string.
NOTES
As with all Modules for Perl: Please stick to using the interface. If you try to fiddle too much with knowledge of the internals of this
module, you may get burned. I may change them at any time.
You can only use TrueType fonts with version of GD > 1.20, and then only if compiled with support for this. If you attempt to do it anyway,
you will get errors.
In the following, terms like 'top', 'upper', 'left' and the like are all relative to the string to be drawn, not to the canvas.
BUGS
Any bugs inherited from GD::Text.
COPYRIGHT
copyright 1999 Martien Verbruggen (mgjv@comdyn.com.au)
SEE ALSO
GD, GD::Text, GD::Text::Wrap
perl v5.12.3 2003-02-24 Text::Align(3pm)