I have a text file with the following format:
id col1 col2 col3 col4 col5 col6 col7 ...
The file is though much larger than this around 3000 rows and 5000 columns. Most lines have only zeros but values are in range of [0,1]. I am interested to print out all lines were there are some values > 0.
I created a short awk script like this:
But that one printed only the values that were greater than zero (and also a little bit more) and I need to print the whole line.
I would really appreciate any help and I hope that my query is clear enough.
-Gauti
Moderator's Comments:
Please use next time code tags for your code and data
I am trying to parse iostat output for io issues..
I want to print all lines including second occurance of 'extended' till EOF(end of file). Can we do that using awk or sed one liners or do we need a script for it? (1 Reply)
Ok so I can use awk to match a pattern and print the whole line with print $0. Is there any way to just tell awk to print every line of output when the pattern matches?
I'm having it wait for the word error and then print that entire line. But what I actually need to see is all the following... (9 Replies)
Hi,
I have code which is like this
<TABLE name="UsageDetail_24>
<ROW>
<Date24><!]></Date24>
<Time24><!]></Time24>
<Destination24><!]></Destination24>
<Rate24><!]></Rate24>
<Duration24><!]></Duration24>
<Cost24><!]></Cost24>
<Allowance24><!]></Allowance24>
</ROW>
<ROW>... (3 Replies)
Hi,
I need help to add a certain values to end of each line in the same file.
Here is my input file
name:aaa
id :123
salary
job
qulification
name:bbb
id :124
salary
job
qulification
name:ccc
id :345
salary
job
qulification (2 Replies)
I am using Solaris, I want to print
3 lines before pattern match
pattern
5 lines after pattern match
Pattern is abcd to be searched in a.txt. Looking for the solution in sed/awk/perl. Thanks ..
Input File a.txt:
=================
1
2
3
abcd
4
5
6
7
8 (7 Replies)
Hi, I have this file.
close
block3c
block3b
block3a
open
close
block2b
block2a
open
close
block1a
open
and I need :
open
block3a
block3b
block3c
close (1 Reply)
I need to print the lines that do not match a pattern. I tried using grep -v and sed -n '/pattern/!p', but both of them are not working as I am passing the pattern as variable and it can be null some times.
Example
........ abcd......
.........abcd......
.........abcd......... (4 Replies)
Hi,
i have been trying to extract multiple lines based on two different patterns as below:-
file1
@jkm|kdo|aas012|192.2.3.1 blablbalablablkabblablabla
sjfdsakfjladfjefhaghfagfkafagkjsghfalhfk
fhajkhfadjkhfalhflaffajkgfajkghfajkhgfkf
jahfjkhflkhalfdhfwearhahfl
@jkm|sdf|wud08q|168.2.1.3... (8 Replies)
URGENT HELP IS NEEDED!!
I am looking to move matching lines (01 - 07) from File1 and 77 tab the matching string from File2, to File3.txt. I am almost done but
- Currently, script is not printing lines to File3.txt in order.
- Also the matching lines are not moving out of File1.txt
... (1 Reply)
Hello,
I have a file contains two columns. I need to print the lines after “xxx” so i'm trying to match "xxx" & cut the lines after that. I'm trying with the grep & cut command, if there any simple way to extract this please help me.
Sample file :
name id
AAA 123
AAB 124
AAC 125... (4 Replies)
Discussion started by: Shenbaga.d
4 Replies
LEARN ABOUT DEBIAN
text::formattable
Text::FormatTable(3pm) User Contributed Perl Documentation Text::FormatTable(3pm)NAME
Text::FormatTable - Format text tables
SYNOPSIS
my $table = Text::FormatTable->new('r|l');
$table->head('a', 'b');
$table->rule('=');
$table->row('c', 'd');
print $table->render(20);
DESCRIPTION
Text::FormatTable renders simple tables as text. You pass to the constructor (new) a table format specification similar to LaTeX (e.g.
"r|l|5l|R|20L") and you call methods to fill the table data and insert rules. After the data is filled, you call the render method and the
table gets formatted as text.
Methods:
new($format)
Create a Text::FormatTable object, the format of each column is specified as a character of the $format string. The following formats
are defined:
l Left-justified top aligned word-wrapped text.
L Left-justified bottom aligned word-wrapped text.
r Right-justified top aligned word-wrapped text.
R Right-justified bottom aligned word-wrapped text.
10R, 20r, 15L, 12l,
Number is fixed width of the column. Justified and aligned word-wrapped text (see above).
' ' A space.
| Column separator.
head($col1, $col2, ...)
Add a header row using $col1, $col2, etc. as cell contents. Note that, at the moment, header rows are treated like normal rows.
row($col1, $col2, ...)
Add a row with $col1, $col2, etc. as cell contents.
rule([$char])
Add an horizontal rule. If $char is specified it will be used as character to draw the rule, otherwise '-' will be used.
render([$screen_width])
Return the rendered table formatted with $screen_width or 79 if it is not specified.
SEE ALSO
Text::ASCIITable
COPYRIGHT
Copyright (c) 2001-2004 Swiss Federal Institute of Technology, Zurich.
(c) 2009 Trey Harris All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
CODE REPOSITORY
Git - http://github.com/treyharris/Text-FormatTable/tree/master
AUTHOR
David Schweikert <dws@ee.ethz.ch>
Maintained by Trey Harris <treyharris@gmail.com>
Fixed column width and bottom alignment written by Veselin Slavov <vslavov@creditreform.bg>
perl v5.10.0 2009-07-24 Text::FormatTable(3pm)