Input:
gstreamer-plugins-good
gstreamer-plugins-bad
gstreamer-plugins-ugly
sed 's/\n/\t/g' infile
It's not working.
Output should be:
gstreamer-plugins-good gstreamer-plugins-bad gstreamer-plugins-ugly
Input:
gstreamer-plugins-good
gstreamer-plugins-bad
gstreamer-plugins-ugly
sed 's/\n/\t/g' infile
It's not working.
Output should be:
gstreamer-plugins-good gstreamer-plugins-bad gstreamer-plugins-ugly
normally it can be done by enter in the sed command, you can search in forum, there are many samples, here is the code that no need "enter" in sed command:
sed -n -e "H;\${g;s/\n/ /g;p}" infile
or
tr "\n" " " < infile
It is not a space.
It it a tab.
so just change it, do you really try to understand the code?
sed -n -e "H;\${g;s/\n/\t/g;p}" infile
tr "\n" "\t" < infile
I know the tr command.
The sed command doesn't work.
Compare the sample output.
# cat file
gstreamer-plugins-good
gstreamer-plugins-bad
gstreamer-plugins-ugly
# sed -e :a -e 'N;s/\n/\t/' -e 'ta' file
gstreamer-plugins-good gstreamer-plugins-bad gstreamer-plugins-ugly