Gossamer Forum
Home : General : Perl Programming :

re-writing a text file

Quote Reply
re-writing a text file
i want to change the order of some lines in a file. i have a .cfg file that contains a list of variables grouped according to purpose. i have another cfg file that has some, but not all, of the same variables and perhaps some additional variables that aren't in file1. i want to create a new file that lists the variables in the order they appear in file1 but with the values in file2. and then i want to append any additional variables in file2 that aren't in file1. oh, and if a variable is in file1, but not in file2, i want the variable listed in file3 in its proper place with a dummy value, say 'xyz'. surely this is possible, but i have no idea where to start. any suggestions? thanks!

the reason i'm asking is i have lots of file2s that need to be converted to this new format.
Quote Reply
Re: [delicia] re-writing a text file In reply to
never mind i figured it out! that was fun!