Sponsored Content
Top Forums Shell Programming and Scripting Identify empty file with null record Post 302976471 by kmanivan82 on Wednesday 29th of June 2016 01:54:43 PM
Old 06-29-2016
Identify empty file with null record

Hi Team,

I have a file abc.dat which is a empty file. But it has null record in first line. I need to identify this unique file and handle it separately.


scenario 1:
Code:
abc/dw> wc abc.dat
1 0 1 abc.dat
abc/dw> cat abc.dat

abc/dw>

scenario 2:
Code:
abc/dw> wc pqr.dat
0 0 0 pqr.dat
abc/dw> cat pqr.dat

abc/dw>

scenario 3:
Code:
abc/dw> wc xyz.dat
2 2 2 xyz.dat
abc/dw> cat xyz.dat
adf 
adsf
abc/dw>

If the file has null record in it
then echo "empty file with null record" -- abc.dat
else echo "empty file" -- pqr.dat
else echo "file has data in it" -- xyz.dat

Can anyone help me out?

Last edited by RudiC; 06-30-2016 at 05:58 AM.. Reason: Changed ICODE to CODE tags.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

If statement falling over on a null record. Help please.

Okay i've got some code which reads a text file and loops through it and there a few if statements inside where one is failing (the one bolded). Basically the acc column contains a list of three digit access codes, some though have null records (i.e nothing in the field) so what I want to do is... (3 Replies)
Discussion started by: TonyR
3 Replies

2. Shell Programming and Scripting

identify the empty directories

Hi Wrote the below script to identify the empty directories ,when executing the below showing that directory is not empty but the directories are empty.Please help to identify the empty directories 33 is not empty 33 is not empty 33 is not empty 33 is not empty for file in `find .... (5 Replies)
Discussion started by: mohan705
5 Replies

3. Shell Programming and Scripting

How to check for null or empty string

Hi, I need to check for value not equal (<>) to 21 and not equal empty or null values. Please modify this script if then echo "$VALUE,$BSC_NAME,$BSC_ID" > $OUT_FILE/power_up.out end if TQ (5 Replies)
Discussion started by: doer
5 Replies

4. Shell Programming and Scripting

Table null is empty

hi I m executing a shell script in which records are to be fetched from a table. If the sql that is running empty result set it is displaying "table null is empty !". I dont want this msg on the standard output. COuld you please help me in this regard (3 Replies)
Discussion started by: priyanka3006
3 Replies

5. Shell Programming and Scripting

PHP: how can I delete empty/NULL elements from a multi-dimensional array.

Hi all I have a file that i'm running and exec(cat ./dat) against..and putting its contents into any array, then doing an exploding the array into a multi-dimension array... The 15 multi-dimensional arrays have elements that are null/empty, I would like to remove/unset these elements and then... (2 Replies)
Discussion started by: zeekblack
2 Replies

6. Shell Programming and Scripting

how to add empty filed to record

hi i have record looks like below 1,US I want to add empty field to the record as below 1, , , ,US how i can do it using awk ? i tried with awk its not working awk '{ print $1", ,"$2 }' filename > file 1 (2 Replies)
Discussion started by: raghavendra.cse
2 Replies

7. Shell Programming and Scripting

Identify Trailer record

Hello, My script has a trailer record(TR). Now I need to implement a logic, if TR is missed on the file it should generate me an email stating TR was not on the file.. Kindly help. (15 Replies)
Discussion started by: Harimalyala
15 Replies

8. Shell Programming and Scripting

awk to identify empty fields in line

I am trying to use awk to identify and print out records in fields that are empty along with which line they are in. I hope the awk below is close, it runs but nothing results. Thank you :). awk awk -F'\t' 'FNR==NR ~ /^*$/ { print "NR is empty" }' file file 123 GOOD ID 45... (3 Replies)
Discussion started by: cmccabe
3 Replies

9. Shell Programming and Scripting

To find record having null value

Hi All My requirement is to find the null values in particular column of a file and reject it in case if it contains null values. But the challenge is that I want a common command which can be used across different file, as the position of the column we need to check for different file may get... (14 Replies)
Discussion started by: ginrkf
14 Replies

10. UNIX for Beginners Questions & Answers

Parsing null or empty output

I am working an some if then statements for a script. I want to be able to check for alpha characters or empty out put then exit out. if ]]; echo "Serial Number Invaild" then exit 3; How do I account if the output is empty or null in this in this statement. Many thanks (6 Replies)
Discussion started by: andysensible
6 Replies
GLSELECTBUFFER(3G)														GLSELECTBUFFER(3G)

NAME
glSelectBuffer - establish a buffer for selection mode values C SPECIFICATION
void glSelectBuffer( GLsizei size, GLuint *buffer ) PARAMETERS
size Specifies the size of buffer. buffer Returns the selection data. DESCRIPTION
glSelectBuffer has two arguments: buffer is a pointer to an array of unsigned integers, and size indicates the size of the array. buffer returns values from the name stack (see glInitNames, glLoadName, glPushName) when the rendering mode is GL_SELECT (see glRenderMode). glSelectBuffer must be issued before selection mode is enabled, and it must not be issued while the rendering mode is GL_SELECT. A programmer can use selection to determine which primitives are drawn into some region of a window. The region is defined by the current modelview and perspective matrices. In selection mode, no pixel fragments are produced from rasterization. Instead, if a primitive or a raster position intersects the clip- ping volume defined by the viewing frustum and the user-defined clipping planes, this primitive causes a selection hit. (With polygons, no hit occurs if the polygon is culled.) When a change is made to the name stack, or when glRenderMode is called, a hit record is copied to buffer if any hits have occurred since the last such event (name stack change or glRenderMode call). The hit record consists of the number of names in the name stack at the time of the event, followed by the minimum and maximum depth values of all vertices that hit since the previous event, followed by the name stack contents, bottom name first. Depth values (which are in the range [0,1]) are multiplied by 2^32 - 1, before being placed in the hit record. An internal index into buffer is reset to 0 whenever selection mode is entered. Each time a hit record is copied into buffer, the index is incremented to point to the cell just past the end of the block of names - that is, to the next available cell. If the hit record is larger than the number of remaining locations in buffer, as much data as can fit is copied, and the overflow flag is set. If the name stack is empty when a hit record is copied, that record consists of 0 followed by the minimum and maximum depth values. To exit selection mode, call glRenderMode with an argument other than GL_SELECT. Whenever glRenderMode is called while the render mode is GL_SELECT, it returns the number of hit records copied to buffer, resets the overflow flag and the selection buffer pointer, and initial- izes the name stack to be empty. If the overflow bit was set when glRenderMode was called, a negative hit record count is returned. NOTES
The contents of buffer is undefined until glRenderMode is called with an argument other than GL_SELECT. glBegin/glEnd primitives and calls to glRasterPos can result in hits. ERRORS
GL_INVALID_VALUE is generated if size is negative. GL_INVALID_OPERATION is generated if glSelectBuffer is called while the render mode is GL_SELECT, or if glRenderMode is called with argu- ment GL_SELECT before glSelectBuffer is called at least once. GL_INVALID_OPERATION is generated if glSelectBuffer is executed between the execution of glBegin and the corresponding execution of glEnd. ASSOCIATED GETS
glGet with argument GL_NAME_STACK_DEPTH glGet with argument GL_SELECTION_BUFFER_SIZE glGetPointerv with argument GL_SELECTION_BUFFER_POINTER SEE ALSO
glFeedbackBuffer, glInitNames, glLoadName, glPushName, glRenderMode GLSELECTBUFFER(3G)
All times are GMT -4. The time now is 05:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy