R
rossnixon
I want to do some tricky text file manipulation, 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 of 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 to start from and end up
with.
------------------------------------- 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 that each one should follow.
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 learning perl, but wonder about the learning curve and
the maintainability of the code.
Thanks, Ross
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 of 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 to start from and end up
with.
------------------------------------- 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 that each one should follow.
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 learning perl, but wonder about the learning curve and
the maintainability of the code.
Thanks, Ross