For the site of the badminton club i use a menu file with the following structure
=-=
..|Jubileum commissie|jubcommissie.php||||1
..|Geschiedenis|geschiedenis.php|Geschiedenis|||0
.|Jubileum|jubileum.php|Jubileum|||1
..|Doedag 1 April 2006|doedag.php|Gezellige doe dag 1 april 2006|||1
..|Clinic NK Badminton 5 februari 2006|jubclinic.php|Clinic bij de NK Badminton 5 februari 2006|||1
...|Verslag Berend|jubclinberend.php||||1
...|Verslag Marlieke|jubclinmarlieke.php||||1
...|Verslag Nick|jubclinnick.php||||1
=-=-=
All the files are generated from a single source.
This file, in turn retrieves the specific part to display.
In this way my navigation in the site is always correct.
The problem was to extract the file names
First i did this with the following sed command sequence:
"s/^[.a-z A-Z0-9]*|//;s/^[a-z A-Z]*|//;s/|[!-~ ]*$//"
This went wrong with the big descriptions.
And, most of all, it was not really an elegant solution.
After some pondering (and some light reading in a perl manual) the following string gave me an elegant solution:
"s/[^|]*|//;s/[^|]*|//;s/|[!-~ ]*$//"
The separators are | so if they are not found, than loop until they are found.
The following file is used to generate all the basic files:
=-=
@echo off
Echo starten
echo Aanmaken filelist
sed "s/[^|]*|//;s/[^|]*|//;s/|[!-~ ]*$//" bcb-menu.txt >1.txt
Echo aanmaken files
echo on
for /f "skip=1" %%a in (1.txt) do copy index.php %%a
=-=-=
So i am able to adapt my menu-structure rather fast.