Sponsored Content
Top Forums Shell Programming and Scripting How to grep an empty line in a specific column of a file? Post 302753031 by Ravi Tej on Tuesday 8th of January 2013 01:49:12 AM
Old 01-08-2013
How to grep an empty line in a specific column of a file?

Suppose i have the following data :

cat file.txt

Code:
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

please suggest the below question :

1 . I want only those rows in which the fourth column is empty .

*********
it should generate the last four lines
*********

Last edited by Scrutinizer; 01-08-2013 at 03:14 AM..
 

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
YPSERV.CONF(5)						       NIS Reference Manual						    YPSERV.CONF(5)

NAME
ypserv.conf - configuration file for ypserv and rpc.ypxfrd DESCRIPTION
ypserv.conf is an ASCII file which contains some options for ypserv. It also contains a list of rules for special host and map access for ypserv and rpc.ypxfrd. This file will be read by ypserv and rpc.ypxfrd at startup, or when receiving a SIGHUP signal. There is one entry per line. If the line is a option line, the format is: option: argument The line for an access rule has the format: host:domain:map:security All rules are tried one by one. If no match is found, access to a map is allowed. Following options exist: files: 30 This option specifies, how many database files should be cached by ypserv. If 0 is specified, caching is disabled. Decreasing this number is only possible, if ypserv is restarted. trusted_master: server If this option is set on a slave server, new maps from the host server will be accepted as master. The default is, that no trusted master is set and new maps will not be accepted. Example: trusted_master: ypmaster.example.org slp: [yes|<no>|domain] If this option is enabled and SLP support compiled in, the NIS server registers itself on a SLP server. If the variable is set to domain, an attribute domain with a comma seperated list of supported domainnames is set. Else this attribute will not be set. The default is "no" (disabled). xfr_check_port: [<yes>|no] With this option enabled, the NIS master server have to run on a port < 1024. The default is "yes" (enabled). The field descriptions for the access rule lines are: host IP address. Wildcards are allowed. Examples: 131.234. = 131.234.0.0/255.255.0.0 131.234.214.0/255.255.254.0 domain specifies the domain, for which this rule should be applied. An asterix as wildcard is allowed. map name of the map, or asterisk for all maps. security one of none, port, deny: none always allow access. port allow access if from port < 1024. Otherwise do not allow access. deny deny access to this map. FILES
/etc/ypserv.conf SEE ALSO
ypserv(8), rpc.ypxfrd(8) WARNINGS
The access rules for special maps are no real improvement in security, but they make the life a little bit harder for a potential hacker. Solaris clients don't use privileged ports. All security options which depend on privileged ports cause big problems on Solaris clients. AUTHOR
Thorsten Kukuk <kukuk@thkukuk.de> NIS Reference Manual 08/02/2006 YPSERV.CONF(5)
All times are GMT -4. The time now is 05:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy