Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Command to extract empty field in a large UNIX file? Post 303032875 by rakeshp on Monday 25th of March 2019 05:34:46 PM
Old 03-25-2019
Command to extract empty field in a large UNIX file?

Hi All,

I have records in unix file like below. In this file, we have empty fields from 4th Column to 22nd Column. I have some 200000 records in a file. I want to extract records only which have empty fields from 4th field to 22nd filed. This file is comma separated file. what is the unix command we can use for this? Please let me know

Code:
x,999999,429,,,,,,,,,,,,,,,,,,,,9999999,999999,xxxxxxxx,,xxxxxxxx,,xxxxxx,xx,xxxxxx,xxxxxxxxxxxxxxxxxxxx,
y,888888,429,,,,,,,,,,,,,,,,,,,,8888888,,xxxxxxxx xxxxxxxx,,xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx,,xxxxxxxx,xxxxxxxx,xxxxxxxx,,,,,
z,777777,429,,,,,,,,,,,,,,,,,,,,6666666,xxxxxxxx,xxxxxxxx xxxxxxxx,,xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx,,xxxxxxxx,xxxxxxxx,xxxxxxxx
A,666666,429,,,,,,,,,,,,,,,,,,,,4444444,,xxxxxxxx xxxxxxxx,,xxxxxxxx xxxxxxxx,,xxxxxxxx,xxxxxxxx,xxxxxxxx,,,,,xxxxxxxx 
B,555555,429,,,,,,,,,,,,,,,,,,,,3333333,,xxxxxxxx xxxxxxxx,,xxxxxxxx xxxxxxxx xxxxxxxx,,xxxxxxxx,
C,444444,429,,,,,,,,,,,,,,,,,,,,2222222,,xxxxxxxx xxxxxxxx,,xxxxxxxx xxxxxxxx xxxxxxxx,,xxxxxxxx xxxxxxxx,
D,333333,429,,,,,,,,,,,,,,,,,,,,5555555,,xxxxxxxx xxxxxxxx,,xxxxxxxx xxxxxxxx xxxxxxxx

Thanks
Rakesh
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Extract data from large file 80+ million records

Hello, I have got one file with more than 120+ million records(35 GB in size). I have to extract some relevant data from file based on some parameter and generate other output file. What will be the besat and fastest way to extract the ne file. sample file format :--... (2 Replies)
Discussion started by: learner16s
2 Replies

2. Shell Programming and Scripting

split large file based on field criteria

I have a file containing date/time sorted data of the form ... 2009/06/10,20:59:59.950,XAG/USD,Q,1,1115, 14.3025,100,1,1 2009/06/10,20:59:59.950,XAG/USD,Q,1,1116, 14.3026,125,1,1 2009/06/10,20:59:59.950,XAG/USD,R,0,0, , 0,0,0 2009/06/10,20:59:59.950,XAG/USD,R,1,0, 14.1910,100,1,1... (6 Replies)
Discussion started by: asriva
6 Replies

3. Shell Programming and Scripting

extract unique pattern from large text file

Hi All, I am trying to extract data from a large text file , I want to extract lines which contains a five digit number followed by a hyphen , like 12345- , i tried with egrep ,eg : egrep "+" text.txt but which returns all the lines which contains any number of digits followed by hyhen ,... (19 Replies)
Discussion started by: shijujoe
19 Replies

4. Shell Programming and Scripting

awk - if field is empty, move line to new file

I have a script with this statement: /usr/xpg4/bin/awk -F"" 'NR==FNR{s=$2;next}{printf "%s\"%s\"\n", $0, s}' LOOKUP.TXT finallistnew.txt >test.txt I want to include logic or an additional step that says if there is no data in field 3, move the whole line out of test.txt into an additional... (9 Replies)
Discussion started by: scriptr2be
9 Replies

5. Shell Programming and Scripting

Format the file by deleting empty field

I have the test data with 10 column separated by comma and each column has more than 1000000 rows. Can anyone help me to find empty field in all columns and delete that empty field alone and lift that column up by one row. Data with empty field: A74203XYZ,A21718XYZ,A72011XYZ,A41095XYZ,... (7 Replies)
Discussion started by: zooby
7 Replies

6. Shell Programming and Scripting

How to extract a field from ls-l command and display?

So I want to put a line at the end of my script which greps for keywords from syslog.log that outputs the following after it is done: "This file was last modified on (thisdate)" I know I can use the following to get the date: rtidsvb(izivanov):/home/izivanov> ll /var/adm/syslog/syslog.log ... (4 Replies)
Discussion started by: zixzix01
4 Replies

7. Shell Programming and Scripting

Splitting large file and renaming based on field

I am trying to update an older program on a small cluster. It uses individual files to send jobs to each node. However the newer database comes as one large file, containing over 10,000 records. I therefore need to split this file. It looks like this: HMMER3/b NAME 1-cysPrx_C ACC ... (2 Replies)
Discussion started by: fozrun
2 Replies

8. Shell Programming and Scripting

How to remove empty field in a text file?

Hi all, I want to remove empty field in a text file. I tried to used sed. But it failed. Input: LG10_PM_map_19_LEnd 1000560 G AG AG LG10_PM_map_19_LEnd 1005621 G AG LG10_PM_map_19_LEnd 1011214 A AG AG LG10_PM_map_19_LEnd 1011673 T CT CT ... (3 Replies)
Discussion started by: huiyee1
3 Replies

9. UNIX for Dummies Questions & Answers

Extract spread columns from large file

Dear all, I want to extract around 300 columns from a very large file with almost 2million columns. There are no headers, but I can find out which column numbers I want. I know I can extract with the function 'cut -f2' for example just the second column but how do I do this for such a large... (1 Reply)
Discussion started by: fndijk
1 Replies

10. Shell Programming and Scripting

Need to extract 8 characters from a large file.

Hi All!! I have a large file containing millions of records. My purpose is to extract 8 characters immediately from the given file. 222222222|ZRF|2008.pdf|2008|01/29/2009|001|B|C|C 222222222|ZRF|2009.pdf|2009|01/29/2010|001|B|C|C 222222222|ZRF|2010.pdf|2010|01/29/2011|001|B|C|C... (5 Replies)
Discussion started by: pavand
5 Replies
LDIF2DB(8)						      System Manager's Manual							LDIF2DB(8)

NAME
ldif2db - Directory Server script for importing a LDIF file SYNOPSIS
ldif2db [-Z serverID] -n backendname {-s includesuffix}* [{-x excludesuffix}*] [-g [string] [-G namespace_id]] {-i ldiffile}* [-c chunk- size] [-O] [-E] [-q] [-h] DESCRIPTION
Imports a LDIF file. Either the option '-n' or '-s' must be used. The server instance must be stopped prior to running this command. OPTIONS
A summary of options is included below: -Z Server Identifier The server ID of the Directory Server instance. If there is only one instance on the system, this option can be skipped. -n Backend Name The name of the LDBM database to restore. Example: userRoot -s includeSuffix Specifies the suffixes to be included or specifies the subtrees to be included. -x excludeSuffix Specifies the suffixes to be excluded or specifies the subtrees to be excluded. -i filename Name for the LDIF file to import. -c Chunk size The number of entries to process before starting a fresh pass during the import. By default this is handled internally by the server. -O Requests that only the core database is created without attribute indexes. -g [string] Generates a unique ID. Type none for no unique ID to be generated and deterministic for the generated unique ID to be name-based. By default, a time-based unique ID is generated. When using the deterministic generation to have a name-based unique ID, it is also possible to specify the namespace for the server to use, as follows: -g deterministic namespaceId namespaceId is a string of characters in the format 00-xxxxxxxx-xxxxxxxx-xxxxxxxx-xxxxxxxx. -G namespace_id Generates a namespace ID as a name-based unique ID. This is the same as specifying the -g deterministic option. -E Encrypts data during import. This option is used only if database encryption is enabled. -v Display verbose ouput -h Display usage EXAMPLE
ldif2db -Z instance1 -n userRoot -i /LDAP/ldif/data.ldif ldif2db -s "dc=example,dc=com" -i /LDAP/ldif/data.ldif DIAGNOSTICS
Exit status is zero if no errors occur. Errors result in a non-zero exit status and a diagnostic message being written to standard error. AUTHOR
ldif2db was written by the 389 Project. REPORTING BUGS
Report bugs to http://bugzilla.redhat.com. COPYRIGHT
Copyright (C) 2013 Red Hat, Inc. Mar 5, 2013 LDIF2DB(8)
All times are GMT -4. The time now is 02:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy