Deleting by ID

Need to delete records from a text file. Very new to this and am using pico. The only way i can think of doing this is to generate an ID for every record then tell it to delete that particular ID. First question is how if possible do i give each entry an ID number, the second is would this code work to delete an ID entry

sed '/.*ID.*/d' list.txt > list.txt

Any other suggestions on ways items can be deleted from a text file?

Thanks for your help

I think I'm following what you're trying to do...

Try:

a=1
while read LINE
do
 echo $a "$LINE" >> tmp_00
 a=`expr $a + 1`
done < list.txt
mv tmp_00 list.txt

to put numbers at the beginning of each line and then use something like:

sed '/^4/d' < list.txt to delete the fourth "record"...