I can do git diff --name-only HEAD develop
which gives a list of file names like this:
a.txt
b.txt
c.txt
How can I transform this to be separated by space like this:
a.txt b.txt c.txt
I can do git diff --name-only HEAD develop
which gives a list of file names like this:
a.txt
b.txt
c.txt
How can I transform this to be separated by space like this:
a.txt b.txt c.txt
$ echo "a.txt
b.txt
c.txt" | paste -s -d ' '
a.txt b.txt c.txt
$
paste
it serially(-s
) with delimiter -d
as space
or use translate tr
command like this:
$ echo "a.txt
b.txt
c.txt" | tr '\n' ' '
a.txt b.txt c.txt
use can use tr command to replace newline
with space
echo file | tr '\n' ' '