I want to do some tricky text file manipulation on many files, but have only a little programming knowledge.
What are the ideal languages for the following examples? 1. Starting from a certain folder, look in the subfolders for all filenames matching *FOOD*.txt Any files matching in each folder should be copied to a new subfolder within the current folder called EATING with a new name of *FOOD*COPY.txt 2. Process each file as follows: Here is a simplified example of what I want as input and output. ------------------------------------- input ......................... 'several unknown lines of text file Get apples from apples shop Get oranges from oranges shop Get plums from plums shop Get pears from pears shop Eat from apples, oranges, plums, pears 'whitespace at start of line is unimportant ......................... 'more unknown lines of text file Chapter 1 Several lines of text about apples in here Chapter 2 Several lines of text about oranges in here Chapter 3 Several lines of text about plums in here Chapter 4 Several lines of text about pears in here ------------------------------------- output ......................... 'several unknown lines of text file Get apples from apples shop Get oranges from oranges shop Get plums from plums shop Get pears from pears shop Get bagels from bagels shop 'the Get lines... Get donuts from donuts shop 'can be in any order Eat from apples, bagels, oranges, plums, donuts, pears 'whitespace at start of line is unimportant ......................... 'more unknown lines of text file Chapter 1 Several lines of text about apples in here Chapter 2 Several lines of text about bagels in here Chapter 3 Several lines of text about oranges in here Chapter 4 Several lines of text about plums in here Chapter 5 Several lines of text about donuts in here Chapter 6 Several lines of text about pears in here Summary: I have added two new items to Get; I have put them into the comma-delimited list after searching for a particular fruit to put each one after; The Chapters are renumbered to match their position in the comma-delimited list. The "several lines of text" about each new item can be pulled from a new_foods.txt file (or a bagels.txt and a donuts.txt file). My first objective is to process the files as described. My second objective is to learn the best language for this sort of text manipulation. The language should run on Windows 98, XP and Linux. Would Python be best, or would a macro-scripting thing like AutoHotKey work? I thought about Perl, but think I would learn bad habits and have hard to read code. Thanks, Ross -- http://mail.python.org/mailman/listinfo/python-list