If I run the command cat file | grep pattern, I get many lines of output. How do you concatenate all lines into one line, effectively replacing each "\n" with "\" " (end with " followed by space)?

cat file | grep pattern | xargs sed s/\n/ /g
isn’t working for me.

11 Answers
11

Leave a Reply

Your email address will not be published. Required fields are marked *