Sponsored Content
Top Forums Shell Programming and Scripting Tput cup, print on current line? Post 302944202 by sea on Sunday 17th of May 2015 06:32:01 AM
Old 05-17-2015
Hehe, its just, tui-echo never ever used "echo", its always been printf.
tput, i only use/d to get columns/width Smilie

What i was saying, printing a 'full' line with the escaped sequence, is still faster than printf, which calculates emptry string and prints them.

Now i only need to print empty strings for the background of the title and header, otherwise there is no 'full-color' background.
Still needs some finetuning, but general handling (align up to 3 variables, or split them according to their lenght/terminal width) is already faster, and lots easier to align.

Was almost asking for help when i had the situation of the screenshot.
A great thing is, the center strings are not more centered than previously. Smilie

Have a nice sunday Smilie
Tput cup, print on current line?-tui-printf-rework-nobgcolorjpg
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

awk to print current date?

List, I want to print the first line of my text file (say "me you"), preceded by the current date/time. Something like (pseudo code): awk '{print date,$1}' I don't have a lot of awk knowledge (understatement), so forgive me if the answer is obvious... (3 Replies)
Discussion started by: philipz
3 Replies

2. Shell Programming and Scripting

Print previous, current and next line using sed

Hi, how can i print the previous, current and next line using sed? current line is the matching line. The following prints all lines containing 'Failure' and also the immediate next line cat $file | sed -n -e '/Failure/{N;p;}' Now, i also want to print the previous line too. Thanks,... (8 Replies)
Discussion started by: ysrinu
8 Replies

3. Shell Programming and Scripting

awk print the next line on the current line

Ok I have a file with hundreds of lines, four columns, space delimited, TESTB.TXT for example TESTB.TXT --- AA ZZ 12 34 BB YY 56 78 CC XX 91 23 DD VV 45 67 --- I want a new file that has 7 columns, the first four are identical, and the next 3 are the last three of the next line...so... (5 Replies)
Discussion started by: ajp7701
5 Replies

4. Shell Programming and Scripting

How to use sed to search for string and Print previous two lines and current line

Hello, Can anybody help me to correct my sed syntax to find the string and print previous two lines and current line and next one line. i am using string as "testing" netstat -v | sed -n -e '/test/{x;2!p;g;$!N;p;D;}' -e h i am able to get the previous line current line next line but... (1 Reply)
Discussion started by: nmadhuhb
1 Replies

5. Shell Programming and Scripting

Vi Editor - How to paste the line concatenated with current line

I generally use yy to copy a line and then p to paste the line at end of current line. But is there a way to paste the copied line in concatenation with the current line with out going to next line. (3 Replies)
Discussion started by: paragkalra
3 Replies

6. UNIX for Dummies Questions & Answers

Awk to print data from current and previous line

Hi guys, I have found your forum super useful. However, right now I am stuck on a seemingly "simple" thing in AWK. I have two columns of data, the first column in Age (in million years) and the second column is Convergence Rate (in mm/yr). I am trying to process my data so I can use it to... (2 Replies)
Discussion started by: awk_noob_456
2 Replies

7. Shell Programming and Scripting

Print the current directory using perl

Hi I have this code to print the current directory using Perl use Cwd qw(abs_path); my $path = abs_path($0); print "$path\n"; But it is displaying my perl source code file along with the directory. like this C:\Perl\duration.pl But I want it only to display this... (1 Reply)
Discussion started by: srijith
1 Replies

8. Shell Programming and Scripting

Sed Comparing Parenthesized Values In Previous Line To Current Line

I am trying to delete lines in archived Apache httpd logs Each line has the pattern: <ip-address> - - <date-time> <document-request-URL> <http-response> <size-of-req'd-doc> <referring-document-URL> This pattern is shown in the example of 6 lines from the log in the code box below. These 6... (1 Reply)
Discussion started by: Proteomist
1 Replies

9. Shell Programming and Scripting

Compare between current and next line and print

Dear All I want below to compare two Consecutive line(i.e. current and next line). Based in that i need OP. Below is the IP file in that in i find "M" and if in next line i find "*" then i need both line in single line. If i dont find "*" in next line then i need to put commend "DOWN" . I am... (4 Replies)
Discussion started by: jaydeep_sadaria
4 Replies

10. UNIX for Beginners Questions & Answers

Print out my current http connection

Good evening Need you help please I just wanna to print out my current https connection and other users http connection which the application resides, for instance i connect to the below url to login into the application: https://serverappp01:14100/portal/Portal.html# In another session... (4 Replies)
Discussion started by: alexcol
4 Replies
Text::Aligner(3pm)					User Contributed Perl Documentation					Text::Aligner(3pm)

NAME
Text::Aligner SYNOPSIS
use Text::Aligner qw( align); # Print the words "just a test!" right-justified each on a line: my @lines = align( 'right', qw( just a test!); print "$_ " for @lines; DESCRIPTION
Text::Aligner exports a single function, align(), which is used to justify strings to various alignment styles. The alignment specification is the first argument, followed by any number of scalars which are subject to alignment. The operation depends on context. In list context, a list of the justified scalars is returned. In scalar context, the justified arguments are joined into a single string with newlines appended. The original arguments remain unchanged. In void context, in-place justification is attempted. In this case, all arguments must be lvalues. Align() also does one level of scalar dereferencing. That is, whenever one of the arguments is a scalar reference, the scalar pointed to is aligned instead. Other references are simply stringified. An undefined argument is interpreted as an empty string without complaint. Alignment respects colorizing escape sequences a la Term::ANSICOLOR, which means it knows that thses sequences don't take up space on the screen. ALIGNMENT
The first argument of the align() function is an alignment style, a single scalar. It can be one of the strings "left", "right", "center", "num", "point", or "auto", or a regular expression (qr/.../), or a coderef. A default style of "left" is assumed for every other value, including "" and undef. "left", "right" and "center" have the obvious meanings. These can also be given as numbers 0, 1, and 0.5 respectively. (Other numbers are also possible, but probably not very useful). "num", and its synonym "point", specify that the decimal points be aligned (assumed on the right, unless present). Arbitrary (non-numeric) strings are also aligned in this manner, so they end up one column left of the (possibly assumed) decimal point, flush right with any integers. For the occasional string like "inf", or "-" for missing values, this may be the right place. A string-only column ends up right-aligned (unless there are points present). The "auto" style separates numeric strings (that are composed of "-", ".", and digits in the usual manner) and aligns them numerically. Other strings are left aligned with the number that sticks out farthest to the left. This gives left alignment for string-only columns and numeric alignment for columns of numbers. In mixed columns, strings are reasonably placed to serve as column headings or intermediate titles. With "num" (and "point") it is possible to specify another character for the decimal point in the form "num(,)". In fact, you can specify any string after a leading "(", and the closing ")" is optional. "point(=>)" could be used to align certain pieces of Perl code. This option is currently not available with "auto" alignment (because recognition of numbers is Anglo-centric). If a regular expression is specified, the points are aligned where the first match of the regex starts. A match is assumed immediately after the string if it doesn't match. A regular expression is a powerful way of alignment specification. It can replace most others easily, except center alignment and, of course, the double action of "auto". POSITIONERS
For entirely self-defined forms of alignment, a coderef, also known as a positioner, can be given instead of an alignment style. This code will be called once or more times with the string to be aligned as its argument. It must return two numbers, a width and a position, that describe how to align a string with other strings. The width should normally be the length of the string. The position defines a point relative to the beginning of the string, which is aligned with the positions given for other strings. A zero position for all strings results in left alignment, positioning to the end of the string results in right alignment, and returning half the length gives center alignment. "num" alignment is realized by marking the position of the decimal point. Note that the position you return is a relative measure. Adding a constant value to all positions results in no change in alignment. It doesn't have to point inside the string (as in right alignment, where it points one character past the end of the string). The first return value of a positioner should almost always be the length of the given string. It may be useful to ly about the string length if the string contains escape sequences that occupy no place on screen. USAGE
use Text::Aligner qw( align); align( $style, $str, ...); $style must be given and must be an alignment specification. Any number of scalars can follow. An argument that contains a scalar reference is dereferenced before it is used. In scalar and list context, the aligned strings are returned. In void context, the values are aligned in place and must be lvalues. BUGS
None known as of realease, but... AUTHOR
Anno Siegel CPAN ID: ANNO COPYRIGHT
Copyright (c) 2002 Anno Siegel. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. SEE ALSO
perl(1) Text::Table perl v5.10.1 2011-06-10 Text::Aligner(3pm)
All times are GMT -4. The time now is 02:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy