Sponsored Content
Top Forums Shell Programming and Scripting Print rows with value zero or less than zero using awk Post 302938074 by RudiC on Wednesday 11th of March 2015 05:20:21 PM
Old 03-11-2015
How about
Code:
awk 'FNR>1  {for(i=2; i<=NF; i++) if($i!=0) next } 1' file

This User Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

print selected rows with awk

Hi everybody: Could anybody tell me how I can print from a file a selected rows with awk. In my case I only want print in another file all the rows from NR=8 to NR=2459 and the increment each 8 times. I tried to this: awk '{for (i=8; i=2459; i+=8); NR==i}' file1 > file2 But doesn't... (6 Replies)
Discussion started by: tonet
6 Replies

2. Shell Programming and Scripting

want to print output if u have rows and columns

U have a file File 1 0.3 0.2 0.4 0.3 0.8 0.11 0.22 0.4 0.23 0.45 0.56 0.78 0.98 0.11 0.32 0.2 0.4 0.45 0.54 0.2 0.33 0.44 0.21 0.22 0.98 0.8 0.2 0.34 0.54 0.98 0.12 0.1 0.22 0.32 0.34 0.89 0.22 File 2 rows columns 3 1 2 3 4 2 5 ... (8 Replies)
Discussion started by: cdfd123
8 Replies

3. UNIX for Advanced & Expert Users

Print rows into columns

Hi, I required to print all rows into columns(some comma separated or else) till a pattern match found. Using Solaris UNIX scripting my input is like abc def ghi jkl mno END pqr stu vwx yz 123 END ... ... (7 Replies)
Discussion started by: vikash.rastogi
7 Replies

4. UNIX for Dummies Questions & Answers

search one row and print next 9 rows

Hi, I'd like your support on this, my file looks like this: 25 50 200 10 0 1 10 6 12 17 26 24 30 319 10 -0.83 3.31 270.646 12.48 -163.04 30.38 0 0 0 -2.88 0.64 16.06 34.4 33.08 34.4 33.08 34.06 20.48 6.22 -33.39 33.96 -33.5840381 -71.6177759 -163.26 25.59 34.1 -28.8 -5.6 -9.9 0 0 0 0... (3 Replies)
Discussion started by: Gery
3 Replies

5. UNIX for Dummies Questions & Answers

Print individual rows.

Hi all, I have a file im reading with a for loop using: for i in $(cat filename) do etc. done the original file is 3 columns, this method prints it out into 3 rows, and i would like to just assign the first to rows (originally first two columns) to separate variables. What would be... (3 Replies)
Discussion started by: jgrosecl
3 Replies

6. UNIX for Dummies Questions & Answers

Awk: Print out overlapping chunks of file - rows 0-20,10-30,20-40 etc.

First time poster, but the forum has saved my bacon more times than... Lots. Anyway, I have a text file, and wanted to use Awk (or any other sensible program) to print out overlapping sections, or arbitrary length. To describe by example, for file 1 2 3 4 5 etc... I want the out put... (3 Replies)
Discussion started by: matfald
3 Replies

7. Shell Programming and Scripting

awk command to print only selected rows in a particular column specified by column name

Dear All, I have a data file input.csv like below. (Only five column shown here for example.) Data1,StepNo,Data2,Data3,Data4 2,1,3,4,5 3,1,5,6,7 3,2,4,5,6 5,3,5,5,6 From this I want the below output Data1,StepNo,Data2,Data3,Data4 2,1,3,4,5 3,1,5,6,7 where the second column... (4 Replies)
Discussion started by: ks_reddy
4 Replies

8. Shell Programming and Scripting

Print various rows in one row

I have this in a file 11.22.33.44 yyyyyyuser With awk/sed, I need this to be output as follows alias server.domain.com='ssh yyyyyyuser@11.22.33.44' (4 Replies)
Discussion started by: anil510
4 Replies

9. Shell Programming and Scripting

Print rows based on separator

For below lines in a file. 68078971 dance routine (jess far back corner) 13902786 368079527 dance routine 13902786 368081191 dance routine (jess far back) 13902786 I am looking for output as below 68078971, "dance routine (jess far back corner)", 13902786... (4 Replies)
Discussion started by: Anjan1
4 Replies

10. Shell Programming and Scripting

Awk- Indexing a list of numbers in file2 to print certain rows in file1

Hi Does anyone know of an efficient way to index a column of data in file2 to print the coresponding row in file1 which corresponds to the data in file2 AND 30 rows preceding and after the row in file1. For example suppose you have a list of numbers in file2 (single column) as follows:... (6 Replies)
Discussion started by: Geneanalyst
6 Replies
Layout::Manager::Grid(3pm)				User Contributed Perl Documentation				Layout::Manager::Grid(3pm)

NAME
Layout::Manager::Grid - Simple grid-based layout manager. DESCRIPTION
Layout::Manager::Grid is a layout manager places components into evenly divided cells. When you instantiate a Grid manager, you must supply it with a count of how many rows and columns it will have. For example, a Grid with 1 column and 2 rows would look like: +--------------------------------+ | | | component 1 | | | +--------------------------------+ | | | component 2 | | | +--------------------------------+ The container is divided into as many <rows> * <columns> cells, with each taking up an equal amount of space. A grid with 3 columns and 2 rows would create 6 cells that consume 33% of the width and 50% of the height. Components are placed by specifying the cell they reside in via the row and column number. $container->add_component($comp, { row => 0, column => 3 }); $container->add_component($comp, { row => 0, column => 2, height => 2 }); Optionally, you may choose to override the default "width" or "height" of 1. Setting it to a something else will cause the component to consume that many rows or columns worth of space. Grid is similar to Java's GridLayout <http://java.sun.com/docs/books/tutorial/uiswing/layout/grid.html>. SYNOPSIS
$cont->add_component($comp1, { row => 0, column => 1 }); $cont->add_component($comp2, { row => 0, column => 2 }); my $lm = Layout::Manager::Grid->new(rows => 1, columns => 2); $lm->do_layout($con); DYNAMIC SIZING If the container that the Grid is manging does not have one or both of it's dimensions set, Grid will compute the appropriate sizes. The simple way for me to avoid writing a long explanation is to say it works similar to HTML tables. Rows will become as big as their biggest consituent, as will columns. It is common to add a Grid-managed component to a scene with only one of it's dimensions set. ATTRIBUTES
columns The number of columns in this Grid. rows The number of rows in this Grid. METHODS
do_layout Size and position the components in this layout. AUTHOR
Cory Watson, "<gphat@cpan.org>" COPYRIGHT &; LICENSE Copyright 2008 - 2010 Cory G Watson This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.3 2011-05-16 Layout::Manager::Grid(3pm)
All times are GMT -4. The time now is 03:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy