System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

remove /dev/dsk using sed in a file

SOLVED
Go to solution
Mike_305
Super Advisor

remove /dev/dsk using sed in a file

Hello,

I have a file with all the disk, stating with /dev/dsk/c1r2d3 and so on.

How can I remove /dev/dsk/ and just keep c1t2d3 in the file.

Appreciate your help.

Regards,

Mp
If there is problem then don't think as problem, think as opportunity.
3 REPLIES
James R. Ferguson
Acclaimed Contributor
Solution

Re: remove /dev/dsk using sed in a file

Hi:

# sed -e 's/\/dev\/dsk\///g' file > file.new

Regards!

...JRF...
Mike_305
Super Advisor

Re: remove /dev/dsk using sed in a file

Hello,

Thanks James.

Appreciate your help.

Regards,

MP
If there is problem then don't think as problem, think as opportunity.
Steven Schweda
Honored Contributor

Re: remove /dev/dsk using sed in a file

Nothing magic about "/" here. If something
else would be more convenient, then use it
instead.

$ echo '/dev/dsk/c1r2d3' | sed -e 's|/dev/dsk/||'
c1r2d3