Please, could you provide a realistic input sample of your file?
Please, could you provide a sample of the kind of output you want based on that input file?
Quote:
Originally Posted by ginrkf
Hi Please find my sample file
File1
For the above file I need to reject the second record as the second column contain null value.
File2
For file 2 by requirement is different where I need to reject a record where 2nd and 4th column is null
So I want to write a unique command where I can pass the column position to check where it is null or not.For ex. I want to pass column position as 2 for the first file and column position as 2&4 for the second file
Unfortunately, you did not provide a sample of the desired output and your words leave a lot to interpretation. The input provided is quite ambiguous, as well, due to the skimpiness of the sample.
In post #1 you said:
Quote:
All my files are pipe delimited
Which make the examples not realistic neither.
Quote:
I need to reject a record where 2nd and 4th column is null
A record normally is a string of characters terminated at the new line (a full human line). Is that the same way you are interpreting it? Do you want the resulted output to exclude any lines that match your criteria?
In your comment "2nd and 4th column is null":
Is your criteria for File2 to exclude the lines that have BOTH fields 2 AND 4 empty or to exclude lines that have EITHER fields 2 OR 4 empty?
Hi,
I would like to use grep to find files which contain NULL characters. I'm not sure how to represent the null character in the grep statement.
Could anyone help please?
Thanks!
Helen :confused: (5 Replies)
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)
Hi All,
I have some csv files out of which i want to find records which have empty values in either the 14th or 16th fields.
The following is a sample.
$cut -d',' -f14,16 SPS* | head -5
VOIP_ORIG_INFO,VOIP_DEST_INFO
sip:445600709315@sip.com,sip:999@sip.com... (2 Replies)
Hi,
i wrote If Conditions in my script, it's returns null and some values.
but i am unable to find when Null value getting. bec we need modification according null vales.
pls help me on this. (2 Replies)
Hi,
I am trying to display the filename in which a string was found after using find and grep. For this after some googling I found that this works:
find -name "*.java" -exec grep "searchStr" {} /dev/null \;
I wanted to know the difference between the above and the following:
find -name... (0 Replies)
Hi,
I've a pipe delimited file where I want to find out a number of lines where 1st 2nd and last field are null using awk/sed. Is it possible?
Thanks (5 Replies)
Hi, everyone
I have a requirement as following:
source file
1, abc, def, caaa
2, , cde, aaa
3, bcd, , adefefg
I need find columns which contains null value, in above example,
I need get two rows
2, , cde, aaa
3, bcd, , adefefg
anybody has idea how to achive this
... (5 Replies)
Hello All,
My apologies if a similar question has already been posted. I searched for "grep", "egrep" and "null"
I'm having an issue with egrep and an extended regular expression.
I'm doing a test for a job name. I would like to have the user enter a job name with no spaces and also test to... (7 Replies)
hi Gurus,
I need find the null column in a file.
my file like below
abc, ,cde,def
abc,ded,cdd,def
abc, ,ddd,ccd
aaa,bbb,ccc,ddd
basic, I need to find the lines which second column is null
Thanks in advance (3 Replies)
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:
abc/dw> wc abc.dat
1 0 1 abc.dat
abc/dw> cat abc.dat
abc/dw>
scenario 2:
abc/dw> wc pqr.dat
0 0 0 pqr.dat... (3 Replies)
Discussion started by: kmanivan82
3 Replies
LEARN ABOUT PHP
db2_field_num
DB2_FIELD_NUM(3) 1 DB2_FIELD_NUM(3)db2_field_num - Returns the position of the named column in a result setSYNOPSIS
int db2_field_num (resource $stmt, mixed $column)
DESCRIPTION
Returns the position of the named column in a result set.
PARAMETERS
o $stmt
- Specifies a statement resource containing a result set.
o $column
- Specifies the column in the result set. This can either be an integer representing the 0-indexed position of the column, or a
string containing the name of the column.
RETURN VALUES
Returns an integer containing the 0-indexed position of the named column in the result set. If the specified column does not exist in the
result set, db2_field_num(3) returns FALSE.
SEE ALSO db2_field_display_size(3), db2_field_name(3), db2_field_precision(3), db2_field_scale(3), db2_field_type(3), db2_field_width(3).
PHP Documentation Group DB2_FIELD_NUM(3)