Sponsored Content
Top Forums Shell Programming and Scripting How to grep an empty line in a specific column of a file? Post 302753495 by Ravi Tej on Wednesday 9th of January 2013 12:39:23 AM
Old 01-09-2013
Grep all the rows that has a particular column (with heading) empty

Code:
A,B,C,D,E,F,G
12431,123334,55353,546646,14342234,4646,35234
123123,3535,123434,132535,1234134,13535,123534
123213,545465,23434,45646,2342345,4656,31243
2355425,2134324,53425,342,35235,23434,234535
3423424,234234,65465,,2344,35436,234524,234
2345235,343224,234234,,234234,646,2342,2354
324234,6456,23424,,45645,234,234,246545,234
342334,234545,234,,2342,4354,2344,235235,2344

Suppose the columns have headings A,B,C,D,E,F,G . I want to grep all the rows in column D which is empty .
This should generate last 4 lines .

Last edited by Scrutinizer; 01-09-2013 at 03:29 AM.. Reason: code tags
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Retrieve line from a file based on a value in specific column

Hi, I have a file that has several values seperated by ":" 2006:John:Student:Football:Portugal:Cinema 2006:James:Engineer:Basket:Poland:Theatre 2007:Lucy:Diver:Gymnastic:England:Music 2007:Smith:Plumber:Basket:Spain:Poker I need make a filter based on the 5th field to find countries that... (1 Reply)
Discussion started by: efernandes
1 Replies

2. UNIX for Dummies Questions & Answers

(cont) Retrieve line from a file based on a value in specific column

HI, Your help was great: awk -F":" '$5 ~ /^P/{print }' file I would like to know what changes need to be done to this line code, so that I can put it in a shell script and call it as the example below. example: countries that start with chacater 'P' > country P Result: ... (0 Replies)
Discussion started by: efernandes
0 Replies

3. Shell Programming and Scripting

grep on specific line of the file

Hi, how can we search for a word (with case ignore )on specific line numbers ex: Awk /^regEX/ with condition on first line or second line Awk/^ regex1/ on line 1 Awk /^regEX2/ on line 3 thanks in advance (4 Replies)
Discussion started by: rider29
4 Replies

4. Shell Programming and Scripting

grep a specific line from a file

Is there a way to grep only one line from a file listing name of files? If I use head -1 it's ok(the first line only) If I use head -2 it's not good because I have already checked the first line. I'd like something like this: while test $i -le $max do grep "$3" `head -$i temp.txt` >... (4 Replies)
Discussion started by: Max89
4 Replies

5. Shell Programming and Scripting

delete empty spaces at specific column

Hi All, If anybody could help me with my scenario here. I have a statement file. Example of some content: DATE DESC Debit Credit Total Rate 02-Jan-08 Lodgement 200.00 1200.00 2.51 14-Sep-07 Withdrawal 50.00 1000.00 ... (8 Replies)
Discussion started by: yonez
8 Replies

6. UNIX for Dummies Questions & Answers

Grep specific records from a file of records that are separated by an empty line

Hi everyone. I am a newbie to Linux stuff. I have this kind of problem which couldn't solve alone. I have a text file with records separated by empty lines like this: ID: 20 Name: X Age: 19 ID: 21 Name: Z ID: 22 Email: xxx@yahoo.com Name: Y Age: 19 I want to grep records that... (4 Replies)
Discussion started by: Atrisa
4 Replies

7. UNIX for Dummies Questions & Answers

Grep from specific column in one file based on another file [Please help!]

Hey Guys, to keep it simple, I have an idFile: 1006006 1006008 1006011 1007002 ...... and famFile: 1006 1006001 1006016 1006017 1 1006 1006006 1006016 1006017 1 1006 1006007 0 0 2 1006 1006008 1006007 1006006 2 1006 1006010 1006016 1006017 2 1006 1006011 1006016 1006017 1 1006... (2 Replies)
Discussion started by: Zoho
2 Replies

8. Shell Programming and Scripting

How to read particular line in file from specific column?

Hi...friends.... I want to create inventory...information for that I need to read some specific row say 2nd row from 1st 3 column and and write data with particular file used, I have some more column also but I need only 3 column data of first entry after header I attached sample file..those... (12 Replies)
Discussion started by: nex_asp
12 Replies

9. Shell Programming and Scripting

Overwrite specific column in xml file with the specific column from adjacent line

I have an xml file dumped from rrd file, that I want to "patch" so the xml file doesn't contain any blank hole in the resulting graph of the rrd file. Here is the file. <!-- 2015-10-12 14:00:00 WIB / 1444633200 --> <row><v> 4.0419731265e+07 </v><v> 4.5045912770e+06... (2 Replies)
Discussion started by: rk4k
2 Replies
Set::Infinite::_recurrence(3pm) 			User Contributed Perl Documentation			   Set::Infinite::_recurrence(3pm)

NAME
Set::Infinite::_recurrence - Extends Set::Infinite with recurrence functions SYNOPSIS
$recurrence = $base_set->_recurrence ( &next, &previous ); DESCRIPTION
This is an internal class used by the DateTime::Set module. The API is subject to change. It provides all functionality provided by Set::Infinite, plus the ability to define recurrences with arbitrary objects, such as dates. METHODS
o _recurrence ( &next, &previous ) Creates a recurrence set. The set is defined inside a 'base set'. $recurrence = $base_set->_recurrence ( &next, &previous ); The recurrence functions take one argument, and return the 'next' or the 'previous' occurence. Example: defines the set of all 'integer numbers': use strict; use Set::Infinite::_recurrence; use POSIX qw(floor); # define the recurrence span my $forever = Set::Infinite::_recurrence->new( Set::Infinite::_recurrence::NEG_INFINITY, Set::Infinite::_recurrence::INFINITY ); my $recurrence = $forever->_recurrence( sub { # next floor( $_[0] + 1 ) }, sub { # previous my $tmp = floor( $_[0] ); $tmp < $_[0] ? $tmp : $_[0] - 1 }, ); print "sample recurrence ", $recurrence->intersection( -5, 5 ), " "; # sample recurrence -5,-4,-3,-2,-1,0,1,2,3,4,5 { my $x = 234.567; print "next occurence after $x = ", $recurrence->{param}[0]->( $x ), " "; # 235 print "previous occurence before $x = ", $recurrence->{param}[2]->( $x ), " "; # 234 } { my $x = 234; print "next occurence after $x = ", $recurrence->{param}[0]->( $x ), " "; # 235 print "previous occurence before $x = ", $recurrence->{param}[2]->( $x ), " "; # 233 } o is_forever Returns true if the set is a single span, ranging from -Infinity to Infinity. o _is_recurrence Returns true if the set is an unbounded recurrence, ranging from -Infinity to Infinity. CONSTANTS
o INFINITY The "Infinity" value. o NEG_INFINITY The "-Infinity" value. SUPPORT
Support is offered through the "datetime@perl.org" mailing list. Please report bugs using rt.cpan.org AUTHOR
Flavio Soibelmann Glock <fglock@gmail.com> The recurrence generation algorithm is based on an idea from Dave Rolsky. COPYRIGHT
Copyright (c) 2003 Flavio Soibelmann Glock. All rights reserved. This program is free software; you can distribute 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
Set::Infinite DateTime::Set For details on the Perl DateTime Suite project please see <http://datetime.perl.org>. perl v5.12.4 2011-08-22 Set::Infinite::_recurrence(3pm)
All times are GMT -4. The time now is 01:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy