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
libcaca canvas frame handling(3caca)				      libcaca				      libcaca canvas frame handling(3caca)

NAME
libcaca canvas frame handling - Functions __extern int caca_get_frame_count (caca_canvas_t const *) Get the number of frames in a canvas. __extern int caca_set_frame (caca_canvas_t *, int) Activate a given canvas frame. __extern char const * caca_get_frame_name (caca_canvas_t const *) Get the current frame's name. __extern int caca_set_frame_name (caca_canvas_t *, char const *) Set the current frame's name. __extern int caca_create_frame (caca_canvas_t *, int) Add a frame to a canvas. __extern int caca_free_frame (caca_canvas_t *, int) Remove a frame from a canvas. Detailed Description These functions provide high level routines for canvas frame insertion, removal, copying etc. Function Documentation __extern int caca_get_frame_count (caca_canvas_t const *cv) Return the current canvas' frame count. This function never fails. Parameters: cv A libcaca canvas Returns: The frame count Referenced by caca_set_canvas_boundaries(). __extern int caca_set_frame (caca_canvas_t *cv, intid) Set the active canvas frame. All subsequent drawing operations will be performed on that frame. The current painting context set by caca_set_attr() is inherited. If the frame index is outside the canvas' frame range, nothing happens. If an error occurs, -1 is returned and errno is set accordingly: o EINVAL Requested frame is out of range. Parameters: cv A libcaca canvas id The canvas frame to activate Returns: 0 in case of success, -1 if an error occurred. References caca_add_dirty_rect(). Referenced by caca_set_canvas_boundaries(). __extern char const* caca_get_frame_name (caca_canvas_t const *cv) Return the current frame's name. The returned string is valid until the frame is deleted or caca_set_frame_name() is called to change the frame name again. This function never fails. Parameters: cv A libcaca canvas. Returns: The current frame's name. __extern int caca_set_frame_name (caca_canvas_t *cv, char const *name) Set the current frame's name. Upon creation, a frame has a default name of 'frame#xxxxxxxx' where xxxxxxxx is a self-incrementing hexadecimal number. If an error occurs, -1 is returned and errno is set accordingly: o ENOMEM Not enough memory to allocate new frame. Parameters: cv A libcaca canvas. name The name to give to the current frame. Returns: 0 in case of success, -1 if an error occurred. __extern int caca_create_frame (caca_canvas_t *cv, intid) Create a new frame within the given canvas. Its contents and attributes are copied from the currently active frame. The frame index indicates where the frame should be inserted. Valid values range from 0 to the current canvas frame count. If the frame index is greater than or equals the current canvas frame count, the new frame is appended at the end of the canvas. If the frame index is less than zero, the new frame is inserted at index 0. The active frame does not change, but its index may be renumbered due to the insertion. If an error occurs, -1 is returned and errno is set accordingly: o ENOMEM Not enough memory to allocate new frame. Parameters: cv A libcaca canvas id The index where to insert the new frame Returns: 0 in case of success, -1 if an error occurred. Referenced by caca_set_canvas_boundaries(). __extern int caca_free_frame (caca_canvas_t *cv, intid) Delete a frame from a given canvas. The frame index indicates the frame to delete. Valid values range from 0 to the current canvas frame count minus 1. If the frame index is greater than or equals the current canvas frame count, the last frame is deleted. If the active frame is deleted, frame 0 becomes the new active frame. Otherwise, the active frame does not change, but its index may be renumbered due to the deletion. If an error occurs, -1 is returned and errno is set accordingly: o EINVAL Requested frame is out of range, or attempt to delete the last frame of the canvas. Parameters: cv A libcaca canvas id The index of the frame to delete Returns: 0 in case of success, -1 if an error occurred. References caca_add_dirty_rect(). Author Generated automatically by Doxygen for libcaca from the source code. Version 0.99.beta18 Fri Apr 6 2012 libcaca canvas frame handling(3caca)
All times are GMT -4. The time now is 09:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy