WLUG
By thread
wlug@lists.wlug.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2000 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- 1 participants
- 11227 messages
Re: [Wlug] Wlug Digest, Vol 80, Issue 1 - AWK
by Steven Greenberg
#!/bin/tcsh
awk -F\| '$3 == "" {print}' < test.txt
109: ./awk.csh
One|two||four|Five|Six
One|two||four|Five|Six
wlug-request(a)mail.wlug.org wrote:
> Send Wlug mailing list submissions to
> wlug(a)mail.wlug.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://mail.wlug.org/mailman/listinfo/wlug
> or, via email, send a message with subject or body 'help' to
> wlug-request(a)mail.wlug.org
>
> You can reach the person managing the list at
> wlug-owner(a)mail.wlug.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Wlug digest..."
>
>
> ------------------------------------------------------------------------
>
> Today's Topics:
>
> 1. Awk Null Field (Gary Hanley)
> 2. Re: Awk Null Field (Jorden M)
> 3. Re: Awk Null Field (Gary Hanley)
> 4. Re: Awk Null Field (Jorden M)
> 5. Re: Awk Null Field (Gary Hanley)
> 6. Re: Awk Null Field (Jorden M)
> 7. Re: Awk Null Field (Theo Van Dinter)
> 8. Re: Awk Null Field (Gary Hanley)
>
>
> ------------------------------------------------------------------------
>
> Subject:
> [Wlug] Awk Null Field
> From:
> Gary Hanley <gary(a)hanley.net>
> Date:
> Tue, 1 Jun 2010 16:00:26 -0400 (EDT)
> To:
> Worcester Linux Users Group <wlug(a)mail.wlug.org>
>
> To:
> Worcester Linux Users Group <wlug(a)mail.wlug.org>
>
>
> 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
>
>
> ------------------------------------------------------------------------
>
> Subject:
> Re: [Wlug] Awk Null Field
> From:
> Jorden M <jrm8005(a)gmail.com>
> Date:
> Tue, 1 Jun 2010 16:26:23 -0400
> To:
> Worcester Linux Users Group <wlug(a)mail.wlug.org>
>
> To:
> Worcester Linux Users Group <wlug(a)mail.wlug.org>
>
>
> Just check NF.
>
> On Tue, Jun 1, 2010 at 4:00 PM, Gary Hanley <gary(a)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(a)mail.wlug.org
>> http://mail.wlug.org/mailman/listinfo/wlug
>>
>
>
> ------------------------------------------------------------------------
>
> Subject:
> Re: [Wlug] Awk Null Field
> From:
> Gary Hanley <gary(a)hanley.net>
> Date:
> Tue, 01 Jun 2010 17:08:46 -0400
> To:
> Worcester Linux Users Group <wlug(a)mail.wlug.org>
>
> To:
> Worcester Linux Users Group <wlug(a)mail.wlug.org>
>
>
> 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(a)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(a)mail.wlug.org
>>> http://mail.wlug.org/mailman/listinfo/wlug
>>>
>> _______________________________________________
>> Wlug mailing list
>> Wlug(a)mail.wlug.org
>> http://mail.wlug.org/mailman/listinfo/wlug
>>
>>
>
>
> ------------------------------------------------------------------------
>
> Subject:
> Re: [Wlug] Awk Null Field
> From:
> Jorden M <jrm8005(a)gmail.com>
> Date:
> Tue, 1 Jun 2010 17:14:36 -0400
> To:
> Worcester Linux Users Group <wlug(a)mail.wlug.org>
>
> To:
> Worcester Linux Users Group <wlug(a)mail.wlug.org>
>
>
> 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(a)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(a)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(a)mail.wlug.org
>>>> http://mail.wlug.org/mailman/listinfo/wlug
>>>>
>>> _______________________________________________
>>> Wlug mailing list
>>> Wlug(a)mail.wlug.org
>>> http://mail.wlug.org/mailman/listinfo/wlug
>>>
>>>
>> _______________________________________________
>> Wlug mailing list
>> Wlug(a)mail.wlug.org
>> http://mail.wlug.org/mailman/listinfo/wlug
>>
>
>
>
> ------------------------------------------------------------------------
>
> Subject:
> Re: [Wlug] Awk Null Field
> From:
> Gary Hanley <gary(a)hanley.net>
> Date:
> Tue, 01 Jun 2010 17:22:05 -0400
> To:
> Worcester Linux Users Group <wlug(a)mail.wlug.org>
>
> To:
> Worcester Linux Users Group <wlug(a)mail.wlug.org>
>
>
> 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(a)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(a)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(a)mail.wlug.org
>>>>> http://mail.wlug.org/mailman/listinfo/wlug
>>>>>
>>>> _______________________________________________
>>>> Wlug mailing list
>>>> Wlug(a)mail.wlug.org
>>>> http://mail.wlug.org/mailman/listinfo/wlug
>>>>
>>>>
>>> _______________________________________________
>>> Wlug mailing list
>>> Wlug(a)mail.wlug.org
>>> http://mail.wlug.org/mailman/listinfo/wlug
>>>
>>
>> _______________________________________________
>> Wlug mailing list
>> Wlug(a)mail.wlug.org
>> http://mail.wlug.org/mailman/listinfo/wlug
>>
>>
>
>
> ------------------------------------------------------------------------
>
> Subject:
> Re: [Wlug] Awk Null Field
> From:
> Jorden M <jrm8005(a)gmail.com>
> Date:
> Tue, 1 Jun 2010 17:24:38 -0400
> To:
> Worcester Linux Users Group <wlug(a)mail.wlug.org>
>
> To:
> Worcester Linux Users Group <wlug(a)mail.wlug.org>
>
>
> So match "| |"? Or perhaps "|[ ]?|"?
>
> Or will that not work?
>
> On Tue, Jun 1, 2010 at 5:22 PM, Gary Hanley <gary(a)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(a)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(a)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(a)mail.wlug.org
>>>>>> http://mail.wlug.org/mailman/listinfo/wlug
>>>>>>
>>>>> _______________________________________________
>>>>> Wlug mailing list
>>>>> Wlug(a)mail.wlug.org
>>>>> http://mail.wlug.org/mailman/listinfo/wlug
>>>>>
>>>>>
>>>> _______________________________________________
>>>> Wlug mailing list
>>>> Wlug(a)mail.wlug.org
>>>> http://mail.wlug.org/mailman/listinfo/wlug
>>>>
>>> _______________________________________________
>>> Wlug mailing list
>>> Wlug(a)mail.wlug.org
>>> http://mail.wlug.org/mailman/listinfo/wlug
>>>
>>>
>> _______________________________________________
>> Wlug mailing list
>> Wlug(a)mail.wlug.org
>> http://mail.wlug.org/mailman/listinfo/wlug
>>
>
>
>
> ------------------------------------------------------------------------
>
> Subject:
> Re: [Wlug] Awk Null Field
> From:
> Theo Van Dinter <felicity(a)kluge.net>
> Date:
> Tue, 1 Jun 2010 17:48:32 -0400
> To:
> Worcester Linux Users Group <wlug(a)mail.wlug.org>
>
> To:
> Worcester Linux Users Group <wlug(a)mail.wlug.org>
>
>
> Unless I'm missing something, you should just be able to do ... awk
> -F\| '$8 {print}'
>
>
> On Tue, Jun 1, 2010 at 4:00 PM, Gary Hanley <gary(a)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(a)mail.wlug.org
>> http://mail.wlug.org/mailman/listinfo/wlug
>>
>
>
> ------------------------------------------------------------------------
>
> Subject:
> Re: [Wlug] Awk Null Field
> From:
> Gary Hanley <gary(a)hanley.net>
> Date:
> Tue, 01 Jun 2010 17:46:17 -0400
> To:
> Worcester Linux Users Group <wlug(a)mail.wlug.org>
>
> To:
> Worcester Linux Users Group <wlug(a)mail.wlug.org>
>
>
> 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(a)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(a)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(a)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(a)mail.wlug.org
>>>>>>> http://mail.wlug.org/mailman/listinfo/wlug
>>>>>>>
>>>>>> _______________________________________________
>>>>>> Wlug mailing list
>>>>>> Wlug(a)mail.wlug.org
>>>>>> http://mail.wlug.org/mailman/listinfo/wlug
>>>>>>
>>>>>>
>>>>> _______________________________________________
>>>>> Wlug mailing list
>>>>> Wlug(a)mail.wlug.org
>>>>> http://mail.wlug.org/mailman/listinfo/wlug
>>>>>
>>>>
>>>> _______________________________________________
>>>> Wlug mailing list
>>>> Wlug(a)mail.wlug.org
>>>> http://mail.wlug.org/mailman/listinfo/wlug
>>>>
>>>>
>>> _______________________________________________
>>> Wlug mailing list
>>> Wlug(a)mail.wlug.org
>>> http://mail.wlug.org/mailman/listinfo/wlug
>>>
>>
>> _______________________________________________
>> Wlug mailing list
>> Wlug(a)mail.wlug.org
>> http://mail.wlug.org/mailman/listinfo/wlug
>>
>>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Wlug mailing list
> Wlug(a)mail.wlug.org
> http://mail.wlug.org/mailman/listinfo/wlug
--
Steven Greenberg Email: steve(a)ssgreenberg.name
251 Holland Rd. Phone: (774)241-0095
Fiskdale, Massachusetts 01518-1231 Web: http://www.ssgreenberg.name
Other Email: s.greenberg(a)ieee.org ssg(a)alum.mit.edu
June 2, 2010
Re: [Wlug] Awk Null Field
by Gary Hanley
That's it! :-)
Thank you Theo. I knew it had to be simple - and it was. I was probably
thinking too much trying to build out the conditional check. My bad.
-- Gary
On 06/01/2010 05:48 PM, Theo Van Dinter wrote:
> Unless I'm missing something, you should just be able to do ... awk
> -F\| '$8 {print}'
>
>
> On Tue, Jun 1, 2010 at 4:00 PM, Gary Hanley<gary(a)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(a)mail.wlug.org
>> http://mail.wlug.org/mailman/listinfo/wlug
>>
> _______________________________________________
> Wlug mailing list
> Wlug(a)mail.wlug.org
> http://mail.wlug.org/mailman/listinfo/wlug
>
>
June 1, 2010
Re: [Wlug] Awk Null Field
by Theo Van Dinter
Unless I'm missing something, you should just be able to do ... awk
-F\| '$8 {print}'
On Tue, Jun 1, 2010 at 4:00 PM, Gary Hanley <gary(a)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(a)mail.wlug.org
> http://mail.wlug.org/mailman/listinfo/wlug
>
June 1, 2010
Re: [Wlug] Awk Null Field
by Gary Hanley
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(a)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(a)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(a)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(a)mail.wlug.org
>>>>>> http://mail.wlug.org/mailman/listinfo/wlug
>>>>>>
>>>>> _______________________________________________
>>>>> Wlug mailing list
>>>>> Wlug(a)mail.wlug.org
>>>>> http://mail.wlug.org/mailman/listinfo/wlug
>>>>>
>>>>>
>>>> _______________________________________________
>>>> Wlug mailing list
>>>> Wlug(a)mail.wlug.org
>>>> http://mail.wlug.org/mailman/listinfo/wlug
>>>>
>>>
>>> _______________________________________________
>>> Wlug mailing list
>>> Wlug(a)mail.wlug.org
>>> http://mail.wlug.org/mailman/listinfo/wlug
>>>
>>>
>> _______________________________________________
>> Wlug mailing list
>> Wlug(a)mail.wlug.org
>> http://mail.wlug.org/mailman/listinfo/wlug
>>
>
> _______________________________________________
> Wlug mailing list
> Wlug(a)mail.wlug.org
> http://mail.wlug.org/mailman/listinfo/wlug
>
>
June 1, 2010
Re: [Wlug] Awk Null Field
by Jorden M
So match "| |"? Or perhaps "|[ ]?|"?
Or will that not work?
On Tue, Jun 1, 2010 at 5:22 PM, Gary Hanley <gary(a)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(a)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(a)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(a)mail.wlug.org
>>>>> http://mail.wlug.org/mailman/listinfo/wlug
>>>>>
>>>> _______________________________________________
>>>> Wlug mailing list
>>>> Wlug(a)mail.wlug.org
>>>> http://mail.wlug.org/mailman/listinfo/wlug
>>>>
>>>>
>>> _______________________________________________
>>> Wlug mailing list
>>> Wlug(a)mail.wlug.org
>>> http://mail.wlug.org/mailman/listinfo/wlug
>>>
>>
>> _______________________________________________
>> Wlug mailing list
>> Wlug(a)mail.wlug.org
>> http://mail.wlug.org/mailman/listinfo/wlug
>>
>>
> _______________________________________________
> Wlug mailing list
> Wlug(a)mail.wlug.org
> http://mail.wlug.org/mailman/listinfo/wlug
>
June 1, 2010
Re: [Wlug] Awk Null Field
by Gary Hanley
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(a)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(a)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(a)mail.wlug.org
>>>> http://mail.wlug.org/mailman/listinfo/wlug
>>>>
>>> _______________________________________________
>>> Wlug mailing list
>>> Wlug(a)mail.wlug.org
>>> http://mail.wlug.org/mailman/listinfo/wlug
>>>
>>>
>> _______________________________________________
>> Wlug mailing list
>> Wlug(a)mail.wlug.org
>> http://mail.wlug.org/mailman/listinfo/wlug
>>
>
> _______________________________________________
> Wlug mailing list
> Wlug(a)mail.wlug.org
> http://mail.wlug.org/mailman/listinfo/wlug
>
>
June 1, 2010
Re: [Wlug] Awk Null Field
by Jorden M
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(a)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(a)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(a)mail.wlug.org
>>> http://mail.wlug.org/mailman/listinfo/wlug
>>>
>> _______________________________________________
>> Wlug mailing list
>> Wlug(a)mail.wlug.org
>> http://mail.wlug.org/mailman/listinfo/wlug
>>
>>
> _______________________________________________
> Wlug mailing list
> Wlug(a)mail.wlug.org
> http://mail.wlug.org/mailman/listinfo/wlug
>
June 1, 2010
Re: [Wlug] Awk Null Field
by Gary Hanley
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(a)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(a)mail.wlug.org
>> http://mail.wlug.org/mailman/listinfo/wlug
>>
> _______________________________________________
> Wlug mailing list
> Wlug(a)mail.wlug.org
> http://mail.wlug.org/mailman/listinfo/wlug
>
>
June 1, 2010
Re: [Wlug] Awk Null Field
by Jorden M
Just check NF.
On Tue, Jun 1, 2010 at 4:00 PM, Gary Hanley <gary(a)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(a)mail.wlug.org
> http://mail.wlug.org/mailman/listinfo/wlug
>
June 1, 2010
Awk Null Field
by Gary Hanley
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
June 1, 2010