Insert # at the start of a matching String

41 Views Asked by At

Current Sample Data

03054;server

03055;server

I am trying to comment out the lines which containing the "server" in a file, but its failing on Solaris server, as below

root@hostname:/root# sed -i '/server/s/^/#/' /tmp/reference.txt

sed: illegal option -- i

The expected output would be

#03054;server

#03055;server

0

There are 0 best solutions below