I want to replace the whitespace with Pipe symbol to do a multiple pattern matching for the whole text "mysqld failed start" and same as for other text messages Below are the messages stored in a file seperate by whitespace
mysqld failed start
nfsd mount failed
rpcbind failed to start
for each text i need to add the pipe symbol so that it will be easier to do mutliple search pattern similar to egrep.
expected o/p
mysqld failed start|nfsd mount failed|rpcbind failed to start
PLEASE USE CODE TAGS! The only trailing space that is visible in your 1st message is a space after the the last start and you haven't replaced it with a | character in the expected output.
What you have shown us is still a single line of input and a single line of output with the 3rd and 6th spaces (which do not appear to be trailing spaces) changed to vertical bars. I still don't understand how to translate your example into a meaningful script.
Please edit your original post and insert appropriate CODE tags so we can see what you're trying to do.