how to remove line from /etc/vfstab using shell / perl

Hi,

 could someone help me on this i want to remove line from /etc/vfstab in the system how to do that 

it is rite now like this

/dev/vx/dsk/appdg1/mytestvol /dev/vx/rdsk/appdg1/mytestvol /mytest vxfs 3 no largefiles
/dev/vx/dsk/appdg1/mytestvol1 /dev/vx/rdsk/appdg1/mytestvol1 /mytest1 vxfs 3 no largefiles
lab1:ksh#

if I want to remove "/dev/vx/dsk/appdg1/mytestvol /dev/vx/rdsk/appdg1/mytestvol /mytest vxfs 3 no largefiles" this line how to do that

perl /shell anything will be help, but it shud be general purpose not specific to value in this example please

thxs
TaD

General purpose:

sed '/pattern/d' file

Specific to the value from your example:

sed '/\/dev\/vx\/dsk\/appdg1\/mytestvol \/dev\/vx\/rdsk\/appdg1\/mytestvol \/mytest vxfs 3 no largefiles/d' vfstab

Note that these commands would not perform any "infile" changes.
You will have to redirect the output to a temporary file and overwrite the old file with that temporary file.
Better you rename your old file in e.g. vfstab.sav - after sed/before overwriting - if something goes wrong.
Hope I was clear :wink:

Here's how to do the erase and create the backup file one-shot with Perl.

perl -pi.bak -e 's/PATTERN//g' /etc/vfstab

replace the string "PATTERN" in the above code with the one pseudocoder already gave you for sed.

Why are you needing to automate the editing of /etc/vfstab? If this is a one-time deal, just open it in a text editor and remove the line. If it is not a one-time deal, what process keeps adding unwanted entries to this important system file? I would be more worried about why you are getting unwanted stuff in there, not just how to remove it.

If you edit this file incorrectly you may make a filesystem inaccessible. Make sure you know what you are erasing!