Prefix and suffix every word in a line for all lines in a file called VP.log

E1 /opt/app/db/ggs/   DF  abc-ctr-vip.ksc2.cci.com 

should become

'E1' '/opt/app/db/ggs/'   'DF'  'abc-ctr-vip.cci.com'

Using sed, wrap each sequence of non-blank characters:

$ sed -E "s/[^[:blank:]]+/'&'/g" VP.log 
'E1' '/opt/app/db/ggs/'   'DF'  'abc-ctr-vip.ksc2.cci.com' 
| improve this answer | |
  • Thank you, it's working. – Moses Jan 13 at 18:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.