What is an efficient way to remove all lines from the input file which contain a file name?
inputfile:
=======================
# comment
# comment
# comment
5 8 10 /tmp
5 8 10 /var/run
5 8 10 /etc/vfstab
5 8 9 /var/tmp
5 8 10 /var/adm/messages
=======================
Desired out put: change all numbers to "1 0 0" and remove lines which contain a file name
=======================
# comment
# comment
# comment
1 0 0 /tmp
1 0 0 /var/run
1 0 0 /var/tmp
========================
My current approach have not addressed "removing line which contain a file name.
#!/bin/ksh
######################################################################
#CREATION DATE: 10/05/2009
#AUTHOR: Jan De Wulf
#SCRIPT TITLE: correct_tivoli.ksh
#PURPOSE: adjust thresholds in /opt/Tivoli/lcf/dat/1/.dm/diskmon/diskmon.cfg
#USAGE: run on target server
#NOTES: Reduces the number of needless Tivoli "disk space threshold alerts"
#MODIFIED:
######################################################################
#====== VARIABLES ========
=/opt/Tivoli/lcf/dat/1/.dm/diskmon/diskmon.cfg
SED=/sysadmin/bin/tivoli_adjust.sed
#====== VARIABLES ========
if test -s $X; then
cp -p $X $X.`date +%Y%m%d`
########## Set DISCOVERY to OFF and set all thresholds to "1 0 0"
sed -f $SED $X > /tmp/$Y.`date +%Y%m%d`
if test -s /tmp/$Y.`date +%Y%m%d`
then
if cmp -s $X /tmp/$Y.`date +%Y%m%d`
then
echo "file not changed:"
rm $X.`date +%Y%m%d`
else
cp /tmp/$Y.`date +%Y%m%d` $X
echo "Editing of file completed"
fi
else
echo "Sed created an empty file"
fi
rm /tmp/$Y.`date +%Y%m%d`
else
echo "original file is blank"
fi
bash-3.00#
#
######################################################################
#CREATION DATE: 10/05/2009
#AUTHOR: Jan De Wulf
#SCRIPT TITLE: tivoli_adjust.sed
#PURPOSE: sed script to correct /opt/Tivoli/lcf/dat/1/.dm/diskmon/diskmon.cfg file
#USAGE: Used by other script or on the command line "sed -f tivoli_adjust.sed xxx
# where xxx = file name to be edited
#NOTES:
#MODIFIED:
######################################################################
s/DISCOVERY=ON/DISCOVERY=OFF/g
{
s/[01-9].[0-9].[0-9][0-9]/1 0 0/g
s/[01-9].[0-9].[0-9]/1 0 0/g
}
bash-3.00#