deleting lines in a file

Sun microsystems Unix essentials featuri...
August 10, 2010 at 10:31:20
Specs: Windows 7
I have created a menu and I am trying to create a script that deletes lines (records) from a file (asg51fin) . when d|D is selected dethe script should prompt for the name and delete the entire line from the file. this is the code I have thus far but it does not work. I
keep getting the following error message.
-d:: unknown test operator

d|D echo "Enter the last name of the record to be deleted: \c"
read $lastname
if [ cut -d: -f1 asg51fin > delete ] ; then
[ grep -v '$lastname' delete asg51fin ]
echo "Record was deleted"
else
echo "Record was not found"
fi ;;


See More: deleting lines in a file

Report •

#1
August 10, 2010 at 19:10:02
sed -i.bak "/$lastname/d" asg51fin

GNU win32 packages | Gawk


Report •
Related Solutions


Ask Question