Using sed command in solaris

One of the most handy things to do with the sed command in solaris is a simple find and replace. In the example below we look at a log file and replace “pseudo” with “HIPPO” for a bit of fun

root@solaris:/var/adm# cat messages | sed s/pseudo/HIPPO/g
Apr 11 10:28:13 solaris HIPPO: [ID 129642 kern.info] HIPPO-device: bpf0
Apr 11 10:28:13 solaris genunix: [ID 936769 kern.info] bpf0 is /HIPPO/bpf@0

the “s/” will tell sed to substitute “pseudo” and “/HIPPO” will replace “pseudo”. “/g” will perform the change globally if there are multiple instances.

Solaris has many handy tools like this, feel free to explore them.