No, that doesn't work. Here's how I tried it. My play file. Notice records two and four: One|two|three|four|Five|Six One|two||four|Five|Six One|two|three|four|Five|Six One|two||four|Five|Six One|two|three|four|Five|Six One|two|three|four|Five|Six Here's the output. Should have returned two records: cat file.txt | awk -F\| '$3 = "| |" {print}' One two | | four Five Six One two | | four Five Six One two | | four Five Six One two | | four Five Six One two | | four Five Six One two | | four Five Six And: cat file.txt | awk -F\| '$3 = "|[ ]?|" {print}' One two |[ ]?| four Five Six One two |[ ]?| four Five Six One two |[ ]?| four Five Six One two |[ ]?| four Five Six One two |[ ]?| four Five Six One two |[ ]?| four Five Six I'm probably have to refresh myself with the regular expression stuff and build a script. Not a bad thing I guess. Somehow I just assumed checking for a blank field in awk was a no-brainer. Now I'm going to have to think. :-\ Thanks Jorden. -- Gary On 06/01/2010 05:24 PM, Jorden M wrote:
So match "| |"? Or perhaps "|[ ]?|"?
Or will that not work?
On Tue, Jun 1, 2010 at 5:22 PM, Gary Hanley<gary@hanley.net> wrote:
There will be a space.
-- Gary
On 06/01/2010 05:14 PM, Jorden M wrote:
What will happen if the field is null? Two pipes? Or will there be space in between?
On Tue, Jun 1, 2010 at 5:08 PM, Gary Hanley<gary@hanley.net> wrote:
Thanks, but that won't help here. Maybe I should have mentioned the fields are delimited by "|" and there is more than eight fields per record.
I think this might be more complicated than I assumed. Thanks anyway.
-- Gary
On 06/01/2010 04:26 PM, Jorden M wrote:
Just check NF.
On Tue, Jun 1, 2010 at 4:00 PM, Gary Hanley<gary@hanley.net> wrote:
Wow, what's wrong with me? I'm trying to parse a file to eliminate any line from the file to the output where a particular field is is null. The 8th field in this case.
I can't get it right! I haven't done an awk script in a long time but this should be simple stuff.
Basically I'm trying to do:
cat file | awk -F\| '$8 !~<NULL expression> {print}'
Any help would be appreciated.
Thanks.
-- Gary _______________________________________________ Wlug mailing list Wlug@mail.wlug.org http://mail.wlug.org/mailman/listinfo/wlug
_______________________________________________ Wlug mailing list Wlug@mail.wlug.org http://mail.wlug.org/mailman/listinfo/wlug
_______________________________________________ Wlug mailing list Wlug@mail.wlug.org http://mail.wlug.org/mailman/listinfo/wlug
_______________________________________________ Wlug mailing list Wlug@mail.wlug.org http://mail.wlug.org/mailman/listinfo/wlug
_______________________________________________ Wlug mailing list Wlug@mail.wlug.org http://mail.wlug.org/mailman/listinfo/wlug
_______________________________________________ Wlug mailing list Wlug@mail.wlug.org http://mail.wlug.org/mailman/listinfo/wlug