Pregunta

I want that rows to rearrangement to columns with spaces between the strings.

q9I6OEFg003411
q9I5IHv5006818
q9I6Gi6P024439
q9I5RoA0019541

Expected view:

q9I6OEFg003411 q9I5IHv5006818 q9I6Gi6P024439 q9I5RoA0019541
¿Fue útil?

Solución

You can use tr to translate <newline> to <space>:

tr '\n' ' ' < file

Also in sed:

sed -n '1h;1!H;${g;s/\n/ /g;p}' file

In awk:

awk -vORS=' ' 1 file

If file is small, you can use cat:

echo `cat file`

If you know vim:

:%s/\n/ /

maybe more ...

Otros consejos

Using paste command:

paste -sd" " file

d option to set delimiter.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top