Grep for NULL in a pipe delimited file

hi,

How can I check for a field in a pipe-delimited file having a NULL value in Unix using a grep command or any other command.

Please reply

What do you mean by NULL field ?
An empty field or a field equal to binary zero ?

Jean-Pierre.

maybe this is what you want:

perl -n  -e 'print $_ if m#\|\|#' somefile 

awk -F "|" '{for (i=0;i<=NF;i++){if(length($i) ==0) { val=$0 }} print val}' file1 > outputfile

or this might be as simple as:

grep "||" somefile

A grep for || doesn't select null field at start or end of line.
Try :

egrep '^\||\|\||\|$' somefile

Note: The egrep command is the same as the grep -E command.

Jean-Pierre.