On Fri, 2008-08-08 at 14:58 +1200, Dave G wrote: > sed "s/WPT001/$WPTN/" $LOC/loc2test.gpx > $LOC/loc2test_sed.gpx > > gave the right result, however one weird thing is that even with > the ../g" global switch it > changed all the "WPT001"'s rather than just the first instance ?
sed works on each line of its input. /g merely means to allow matching multiple times _on one line_ you may need to look for a tool that doesn't treat each line independently, although I would highly recommend considering an alternative approach such as that suggested by Andrew. -Jasper
