Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Feb 2023 12:43:20 +0100 (CET)
From:      Sysadmin Lists <sysadmin.lists@mailfence.com>
To:        Freebsd Questions <freebsd-questions@freebsd.org>
Cc:        jin guojun <jguojun@gmail.com>
Subject:   Re: BSD-awk print() Behavior
Message-ID:  <1141880522.223846.1676979800157@ichabod.co-bxl>
In-Reply-To: <CAE6yT5unTF5S=gt3oFy2-MhAdv-rDO660Dw4Y0O_AFQwSLnp%2Bw@mail.gmail.com>
References:  <1600449078.170379.1676939080787@fidget.co-bxl> <CAE6yT5unTF5S=gt3oFy2-MhAdv-rDO660Dw4Y0O_AFQwSLnp%2Bw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
------=_Part_223843_1098578769.1676979800156
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

On Feb 20, 2023 at 5:13 PM, jin guojun <jguojun@gmail.com> wrote:
Without knowing what hidden character(s) in those files, how one can guess =
what happened.

hexdump -C file_{1,2} can show what is the real difference, which may help =
to understand what is going on with awk print.

-Jin

On Mon, Feb 20, 2023 at 4:25 PM Sysadmin Lists <sysadmin.lists@mailfence.co=
m> wrote:

$ diff file_{1,2}=C2=A0=20
1,2c1,2
< https://github.com/
< https://github.com/
---
> https://github.com/
> https://github.com/

$ awk '{ print $0 " abc " }' file_{1,2}=C2=A0=20
=C2=A0abc ://github.com/
=C2=A0abc ://github.com/
https://github.com/ abc=20
https://github.com/ abc

Thanks. I found the answer already, but this would also have lead me in the
right direction, too.

It shows a difference (single trailing dot verses double-dot) for the two f=
iles:

$ hexdump -C file_{1,2}=C2=A0
00000000=C2=A0 68 74 74 70 73 3a 2f 2f=C2=A0 67 69 74 68 75 62 2e 63=C2=A0 =
|https://github.c|
00000010=C2=A0 6f 6d 2f 0d 0a 68 74 74=C2=A0 70 73 3a 2f 2f 67 69 74=C2=A0 =
|om/..https://git|
00000020=C2=A0 68 75 62 2e 63 6f 6d 2f=C2=A0 0d 0a 68 74 74 70 73 3a=C2=A0 =
|hub.com/..https:|
00000030=C2=A0 2f 2f 67 69 74 68 75 62=C2=A0 2e 63 6f 6d 2f 0a 68 74=C2=A0 =
|//github.com/.ht|
00000040=C2=A0 74 70 73 3a 2f 2f 67 69=C2=A0 74 68 75 62 2e 63 6f 6d=C2=A0 =
|tps://github.com|
00000050=C2=A0 2f 0a=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|/.|
00000052
-- Sent with https://mailfence.com  Secure and private email
------=_Part_223843_1098578769.1676979800156
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

<div style=3D'font-family:Times New Roman; color:#000000; font-size:18px;'>=
<div>On Feb 20, 2023 at 5:13 PM, jin guojun &lt;jguojun@gmail.com&gt; wrote=
:<blockquote type=3D"cite" cite=3D"<CAE6yT5unTF5S=3Dgt3oFy2-MhAdv-rDO660Dw4=
Y0O_AFQwSLnp+w@mail.gmail.com>"><div dir=3D"ltr"><div>Without knowing what =
hidden character(s) in those files, how one can guess what happened.</div><=
div><br></div><div>hexdump -C file_{1,2} can show what is the real differen=
ce, which may help to understand what is going on with awk print.</div><div=
><br></div><div>-Jin<br></div></div><br><div class=3D""><div dir=3D"ltr" cl=
ass=3D"">On Mon, Feb 20, 2023 at 4:25 PM Sysadmin Lists &lt;<a href=3D"mail=
to:sysadmin.lists@mailfence.com">sysadmin.lists@mailfence.com</a>&gt; wrote=
:<br></div><blockquote class=3D"" style=3D"margin:0px 0px 0px 0.8ex;border-=
left:1px solid rgb(204,204,204);padding-left:1ex"><br>
$ diff file_{1,2}&nbsp; <br>
1,2c1,2<br>
&lt; <a href=3D"https://github.com/" rel=3D"noreferrer" target=3D"_blank">h=
ttps://github.com/</a><br>
&lt; <a href=3D"https://github.com/" rel=3D"noreferrer" target=3D"_blank">h=
ttps://github.com/</a><br>
---<br>
&gt; <a href=3D"https://github.com/" rel=3D"noreferrer" target=3D"_blank">h=
ttps://github.com/</a><br>
&gt; <a href=3D"https://github.com/" rel=3D"noreferrer" target=3D"_blank">h=
ttps://github.com/</a><br>
<br>
$ awk '{ print $0 " abc " }' file_{1,2}&nbsp; <br>
&nbsp;abc ://<a href=3D"http://github.com/" rel=3D"noreferrer" target=3D"_b=
lank">github.com/</a><br>
&nbsp;abc ://<a href=3D"http://github.com/" rel=3D"noreferrer" target=3D"_b=
lank">github.com/</a><br>
<a href=3D"https://github.com/" rel=3D"noreferrer" target=3D"_blank">https:=
//github.com/</a> abc <br>
<a href=3D"https://github.com/" rel=3D"noreferrer" target=3D"_blank">https:=
//github.com/</a> abc<br>
<br></blockquote></div></blockquote><div><br></div><div><div>Thanks. I foun=
d the answer already, but this would also have lead me in the</div><div>rig=
ht direction, too.</div><div><br></div><div>It shows a difference (single t=
railing dot verses double-dot) for the two files:</div></div></div><div><br=
></div><div><div>$ hexdump -C file_{1,2}&nbsp;</div><div>00000000&nbsp; 68 =
74 74 70 73 3a 2f 2f&nbsp; 67 69 74 68 75 62 2e 63&nbsp; |https://github.c|=
</div><div>00000010&nbsp; 6f 6d 2f 0d 0a 68 74 74&nbsp; 70 73 3a 2f 2f 67 6=
9 74&nbsp; |om/..https://git|</div><div>00000020&nbsp; 68 75 62 2e 63 6f 6d=
 2f&nbsp; 0d 0a 68 74 74 70 73 3a&nbsp; |hub.com/..https:|</div><div>000000=
30&nbsp; 2f 2f 67 69 74 68 75 62&nbsp; 2e 63 6f 6d 2f 0a 68 74&nbsp; |//git=
hub.com/.ht|</div><div>00000040&nbsp; 74 70 73 3a 2f 2f 67 69&nbsp; 74 68 7=
5 62 2e 63 6f 6d&nbsp; |tps://github.com|</div><div>00000050&nbsp; 2f 0a&nb=
sp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &=
nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=
 &nbsp;|/.|</div><div>00000052</div></div></div>

--=20
Sent with https://mailfence.com =20
Secure and private email

------=_Part_223843_1098578769.1676979800156--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1141880522.223846.1676979800157>