# \#558: /topic/gilbert/ascii-header

**URL:** <https://community.zeek.org/t/558-topic-gilbert-ascii-header/1995>\
**Category:** Development\
**Tags:** development\
**Created:** [August 18, 2011, 3:46pm UTC](https://community.zeek.org/t/558-topic-gilbert-ascii-header/1995 "2011-08-18T15:46:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![robin](https://yyz1.discourse-cdn.com/flex011/user_avatar/community.zeek.org/robin/32/599_2.png) [@robin](https://community.zeek.org/u/robin)\
**Post date:** [August 18, 2011, 3:46pm UTC](https://community.zeek.org/t/558-topic-gilbert-ascii-header/1995/1 "2011-08-18T15:46:29Z")

</div>

Yes, I think it does what I think it does. 🙂 THis prints the  
separator as I would expect it to:

&nbsp;&nbsp;&nbsp;&nbsp;echo -e "#separator ;\n1;2;3;4\n" | awk '/#separator/ {FS=$2; print $2}'

But it doesn't apply the new FS, at least on my Mac awk.

Anyway, let's just pick something and go ahead. I still prefer the  
whitespace here[1] so why don't we always make the first line look  
like this

&nbsp;&nbsp;&nbsp;&nbsp;{{{  
&nbsp;&nbsp;&nbsp;&nbsp;#seperator \t  
&nbsp;&nbsp;&nbsp;&nbsp;}}}

(Indeed with the standard C escaping for non-printable characters).

[1] Because the escaping makes sure there's no whitespace in the  
separator itself.

---

<div class="post-metadata">

**Author:** ![Gregor\_Maier](https://avatars.discourse-cdn.com/v4/letter/g/94ad74/32.png) [@Gregor\_Maier](https://community.zeek.org/u/Gregor_Maier)\
**Post date:** [August 18, 2011, 5:45pm UTC](https://community.zeek.org/t/558-topic-gilbert-ascii-header/1995/2 "2011-08-18T17:45:09Z")

</div>

> Yes, I think it does what I think it does. 🙂 THis prints the  
> separator as I would expect it to:
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo -e "#separator ;\n1;2;3;4\n" | awk '/#separator/ {FS=$2; print $2}'
> 
> But it doesn't apply the new FS, at least on my Mac awk.

I don't know but it works on mine. What's the problem you are facing? The new FS will only apply to the following lines, not the current one. (And you'll also need a rule for lines without /#separator/):

$ echo -e "#separator ;\n1;2;3;4\n" |\  
&nbsp;&nbsp;&nbsp;&nbsp;awk '/#separator/ {FS=$2; print "sep",$2} !/#separator/ { print "field3",$3} '  
sep ;  
field3 3  
field3

$ uname -a  
Darwin tongariro 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE\_I386 i386 i386

$ which awk  
/usr/bin/awk

cu  
Gregor

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/zeek/original/1X/f09d732bc2cc7c7cc7e35db67cf4e1d5233ce7a7.png) [@system](https://community.zeek.org/u/system)\
**Post date:** [May 6, 2022, 3:39pm UTC](https://community.zeek.org/t/558-topic-gilbert-ascii-header/1995/3 "2022-05-06T15:39:47Z")

</div>


