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
INTERFACE-ORDER(5)						    resolvconf							INTERFACE-ORDER(5)

NAME
interface-order - resolvconf configuration file DESCRIPTION
The file /etc/resolvconf/interface-order is used to control the order in which resolvconf nameserver information records are processed by those resolvconf update scripts that consult this file. (The name of the file is apt because a resolvconf nameserver information record is named after the interface with which it is associated.) The file contains a sequence of shell glob patterns, one per line. The position of a record in the order is the point at which its name first matches a pattern. Patterns may not contain whitespace, slashes or initial dots or tildes. Blank lines and lines beginning with a '#' are ignored. Resolvconf update scripts in /etc/resolvconf/update.d/ that consult this file include the current default versions of dnsmasq, pdnsd and libc. (Actually they don't read the file directly; they call the utility program /lib/resolvconf/list-records which lists records in the specified order and omits the names of empty records.) EXAMPLE
# /etc/resolvconf/interface-order # Use nameservers on the loopback interface first. lo* # Next use records for Ethernet interfaces eth* # Next use records for Wi-Fi interfaces wlan* # Next use records for PPP interfaces ppp* # Last use other interfaces * AUTHOR
Resolvconf was written by Thomas Hood <jdthood@gmail.com>. COPYRIGHT
Copyright (C) 2004, 2011 Thomas Hood This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICU- LAR PURPOSE. SEE ALSO
resolvconf(8) resolvconf 18 May 2011 INTERFACE-ORDER(5)
All times are GMT -4. The time now is 06:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy