From owner-freebsd-questions@freebsd.org Sat Sep 9 19:26:30 2017 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 615C8E0428B for ; Sat, 9 Sep 2017 19:26:30 +0000 (UTC) (envelope-from guru@unixarea.de) Received: from ms-10.1blu.de (ms-10.1blu.de [178.254.4.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 200CF74EBE for ; Sat, 9 Sep 2017 19:26:29 +0000 (UTC) (envelope-from guru@unixarea.de) Received: from [89.204.135.251] (helo=localhost.unixarea.de) by ms-10.1blu.de with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.86_2) (envelope-from ) id 1dqkHD-0006re-9H; Sat, 09 Sep 2017 20:14:43 +0200 Received: from localhost.my.domain (localhost [127.0.0.1]) by localhost.unixarea.de (8.15.2/8.14.9) with ESMTPS id v89IEeHo002983 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 9 Sep 2017 20:14:40 +0200 (CEST) (envelope-from guru@unixarea.de) Received: (from guru@localhost) by localhost.my.domain (8.15.2/8.14.9/Submit) id v89IEdXg002982; Sat, 9 Sep 2017 20:14:39 +0200 (CEST) (envelope-from guru@unixarea.de) X-Authentication-Warning: localhost.my.domain: guru set sender to guru@unixarea.de using -f Date: Sat, 9 Sep 2017 20:14:38 +0200 From: Matthias Apitz To: Manish Jain Cc: "freebsd-questions@freebsd.org" Subject: Re: Why does wc increase character count by 1 ? Message-ID: <20170909181438.GA2868@c720-r314251> Reply-To: Matthias Apitz Mail-Followup-To: Matthias Apitz , Manish Jain , "freebsd-questions@freebsd.org" References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="AqsLC8rIMeq19msA" Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD 12.0-CURRENT r314251 (amd64) X-message-flag: Mails containing HTML will not be read! Please send only plain text. User-Agent: Mutt/1.8.0 (2017-02-23) X-Con-Id: 51246 X-Con-U: 0-guru X-Originating-IP: 89.204.135.251 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Sep 2017 19:26:30 -0000 --AqsLC8rIMeq19msA Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable El d=C3=ADa s=C3=A1bado, septiembre 09, 2017 a las 06:10:41p. m. +0000, Man= ish Jain escribi=C3=B3: > Hi, >=20 > echo "abc 123" | wc -c >=20 > I would expect wc to output 7, but actually I get 8. >=20 > Indeed, I see similar behaviour with 'echo | wc -c' > This should produce 0, but I get 1 >=20 > What might be the problem ? Thanks for any tips. > Manish Jain $ echo "abc 123" | od -c 0000000 a b c 1 2 3 \n 0000010 As you see, echo adds one by of \n matthias --=20 Matthias Apitz, =E2=9C=89 guru@unixarea.de, =E2=8C=82 http://www.unixarea.d= e/ =E2=98=8E +49-176-38902045 Public GnuPG key: http://www.unixarea.de/key.pub 8. Mai 1945: Wer nicht feiert hat den Krieg verloren. 8 de mayo de 1945: Quien no festeja perdi=C3=B3 la Guerra. May 8, 1945: Who does not celebrate lost the War. --AqsLC8rIMeq19msA Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEXmn7rBYYViyzy/vBR8z35Hb+nREFAlm0L4sACgkQR8z35Hb+ nRGzKA/9EcBufrtVWGUtDA3q5Q0BwNKYNXgeKG4iSXuNHTT8uS+qw4OcPMuo5yda tiZrAFUcnhFjLxIR0icaMSLsoh6o0UYldiv2xi6tAdRT8k+RWR196eX8SBcwwkhZ 2WALd6zZshPgsWNiLxuyNQAXmiXjsKHs8/lPvzGx/249XbUwMjZ8bEb0naboNKYJ 7fBz885rVMNpTpwejP6bALAGAZOKva/wKN50bRCJEgw9cOnDKojvQaU6+W1wBPIg 1yXCnf5SGeEiaacM7+XSb6IupjAHC9UObixoRqou6MDfQ9bOKw8e/Jwfx76C+GLF iFdDjniPFiNUUTSKw7jQetoUOFAMwh4psidzYPpqzqI8vszhvuscTwezHnCzEtT9 PbJbvnlhY/DxoKCrFiZoS2+tLcLr5nLTgsWe+VE3hK2ntLhg5g0uVNDmQp3ZPq+a wkqAev+weoMOUx0zrXwtb284rshSBmEfSToOUtO5m7J7RlvmZUkn7jZSGOmL/kJP PDOKQVwBqLrrZ2F09vXjvIdqPQ3DtEsms9s3TjFYKdnBuE/jRSk6V6x+6dvEotkq xQA+GokxU1RDQ1CC82/zQ3sKSrDKghMm2tjJoonD0BJC95c4dhxxC7znCh3C1E4s su21lUfxfJiqC4hWRVhLmn+PhI/JOfK8WZrcW/wRhnj/aFy4ycA= =tZu4 -----END PGP SIGNATURE----- --AqsLC8rIMeq19msA--