considering that a inventory can have lots of items, items types, different sizes, etc, (assuming a RPG) I'll suggest a different approach from a text file that can give you some really powerful tools.
Use a dataset. Within a dataset it's much easier to locate, modify, process and generate data...