Re: BSD-awk print() Behavior

From: Sysadmin Lists <sysadmin.lists_at_mailfence.com>
Date: Tue, 21 Feb 2023 11:43:20 UTC
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.com> wrote:

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

$ awk '{ print $0 " abc " }' file_{1,2}  
 abc ://github.com/
 abc ://github.com/
https://github.com/ abc 
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 files:

$ hexdump -C file_{1,2} 
00000000  68 74 74 70 73 3a 2f 2f  67 69 74 68 75 62 2e 63  |https://github.c|
00000010  6f 6d 2f 0d 0a 68 74 74  70 73 3a 2f 2f 67 69 74  |om/..https://git|
00000020  68 75 62 2e 63 6f 6d 2f  0d 0a 68 74 74 70 73 3a  |hub.com/..https:|
00000030  2f 2f 67 69 74 68 75 62  2e 63 6f 6d 2f 0a 68 74  |//github.com/.ht|
00000040  74 70 73 3a 2f 2f 67 69  74 68 75 62 2e 63 6f 6d  |tps://github.com|
00000050  2f 0a                                             |/.|
00000052
-- Sent with https://mailfence.com  Secure and private email