Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

191
Visualizações
wc -m in unix adds one character

Counting a line with 4 characters with no new line character:

ACTG

wc -m gives me 5. With echo, I can fix this problem so

echo -n 'ACTG' | wc -m

But if ACTG is in a text file with no new line character, I get 5. Why is that so?

$ ls -l file

-rw-rw-r-- 1 user user 5 Feb 11 15:27 file
$ hexdump -C file

00000000  41 42 43 44 0a                                    |ABCD.|
00000005
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

As hexdump has shown you, whatever editor you are using is adding a '\n' or 0x0A (new line) character at the end of the line when you save the file, even if you aren't writing one explicitly.

See: http://www.asciitable.com/

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda