Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

199
Vistas
Linux merging files

I'm doing a linux online course but im stuck with a question, you can find the question below.

You will get three files called a.bf, b.bf and c.bf. Merge the contents of these three files and write it to a new file called abc.bf. Respect the order: abc.bf must contain the contents of a.bf first, followed by those of b.bf, followed by those of c.bf.

Example Suppose the given files have the following contents:

a.bf contains +++.

b.bf contains [][][][].

c.bf contains <><><>.

The file abc.bf should then have

+++[][][][]<><><>

as its content. I know how to merge the 3 files but when i use cat my output is:

+++
[][][]
<><><>

When i use paste my output is "+++ 'a lot of spaces' [][][][] 'a lot of spaces' <><><>"

My output that i need is +++[][][][]<><><>, i dont want the spaces between the content. Can someone help me?

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

echo -n "$(cat a.bf)$(cat b.bf)$(cat c.bf)" > abc.bf

  • echo -n will not output trailing newlines
over 4 years ago · Santiago Trujillo Denunciar

0

What you want to do is delete the newline characters.

With tr:

cat {a,b,c}.bf | tr --delete '\n' > abc.bf

With echo & sed:

echo $(cat {a,b,c}.bf) | sed -E 's/ //g' > abc.bf

With xargs & sed:

<{a,b,c}.bf xargs | sed -E 's/ //g' > abc.bf

Note that sed is only used to remove the spaces.

With cat & sed:

cat {a,b,c}.bf | sed -z 's/\n//g'
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda