what am trying to do is delete a line in a specific file but I dont know what to do. I cant use the sed or awk commands because these commands dont really alter the original file. they only alter what they display on the screen
by the way, am trying to do this from a script so if anybody can help me, I'd really appreciate it.
You can use sed or awk because I don't believe there is any such command that will delete a line without creating a new file.
Simply - use grep -v and search for the specific line (as long as your grep statement is correct you will remove only that line). Send the output to a new temp file and then move it back to the original filename. If you try to use grep -v and send the output to the original file, you would be left with a 0 byte file.
What about using "ed", or "ex"?
Say, you had a list of files and directories in a text file named tmp.list.
If you wanted to get rid of all items matching "Desktop" (the same as using "grep -v Desktop tmp.list > file.tmp; mv file.tmp tmp.list), you could do this:
Don't know too much about ed - I'm fairly comfortable with vi - never used ed...... how limited is it compared with vi (I assue it's not a viewable editor....) ???
No, it's very much line oriented. I very very very rarely use it, and for that reason don't know too much about it. The man page on my system if fairly helpful though. You might also see if you've got "ex" installed - I believe it's a little more friendly / powerful.