The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to check Null values in a file column by column if columns are Not NULLs Mandab Shell Programming and Scripting 7 03-15-2008 09:57 AM
comparing the null values in the unix bbc17484 Shell Programming and Scripting 11 02-12-2008 09:36 AM
handling null values in files ammu Shell Programming and Scripting 1 11-06-2007 04:43 PM
Null values after emptying a log file kasie4life Shell Programming and Scripting 2 10-07-2004 10:36 AM
Identifying and removing control characters in a file. oracle8 High Level Programming 0 04-13-2004 07:08 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-12-2008
dsravan dsravan is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 190
identifying null values in a file

I have a huge file with 20 fileds in each record and each field is seperated by "|". If i want to get all the reocrds that have 18th or for that matter any filed as null how can i do it? Please let me know
  #2 (permalink)  
Old 02-12-2008
bobbygsk bobbygsk is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 90
To identify the null values on any field
Quote:
grep "||" filename
  #3 (permalink)  
Old 02-12-2008
dsravan dsravan is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 190
But i want to see if particular field is null or not and not regular nulls in the file
  #4 (permalink)  
Old 02-12-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,805

Code:
# lets do it for field #18
fld=18
awk -v fld=$fld ' -F'|'  \
   ' { if ($fld=="") { print "Line " $NR " has field " $fld " NULL" }}' myfile

Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:52 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0