I am doing grep and sed and I get 2 lines of a file that I am interested in. How can I get these lines in a single line ending with the new line character?
Now I am getting:
pattern1
pattern2
I would like to get pattern1 pattern2 \n
grepregular expressionsed
I am doing grep and sed and I get 2 lines of a file that I am interested in. How can I get these lines in a single line ending with the new line character?
Now I am getting:
pattern1
pattern2
I would like to get pattern1 pattern2 \n
Best Answer
paste
:That says: "read a line from stdin (the first
-
), read another line from stdin (the second-
), then join them with a space"a bash-specific technique:
ref: http://www.gnu.org/software/bash/manual/bashref.html#index-mapfile