I have a file where in it has lot of records in it.
I have written below stuff to find the number of fields as shown below
`awk -F '|' '{print NF-1}' file.txt| head -1`
[/CODE]
how do i proceed if in case any record in particular is having more number of delimiters, if it having??? what is the record content (need to print that particular record)?
for example
I have content of table
id|name|desc
1|Raj|null|
2|Nick|NA
0|Digu|fine with it
3|NA|go ahead
0|Digu|fine with it
100|Digu|fine with it
4|Duvi|baby
In case you need only those lines which are having more number of delimiters following may help you. Taken code from RudiC's suggestion with a minor edit in it as follows.
One more thing, I will validate the number of delimiters based on the very first row of the file that is the header. So can we include that as well in the check with the script u gave.