Quote:
Originally Posted by danmero
I can't see where is the problem ... can you elaborate ?
Starting from your original data sample I get:
Code:
# awk '/<ROW/{close("row"c".xml");c++}c{f="row"c".xml";print $0 > f}' file
# ls
file row1.xml row2.xml row3.xml
|
Ah, I see the issue. If I test with the sample XML I provided in the original post, it works. But it's when I try to execute it on the actual XML export from FileMaker that it fails and just stops after creating one file, which contains all of the < ROW matches.
I think maybe it's because the FileMaker XML export is really crappy and has absolutely no formatting at all, there's no line breaks, no indenting, no nothing, all the instances of the < ROW > </ROW> node are all on the same line.
Would that be an issue and is there a way around it?
Quote:
Originally Posted by jp2542a
what happens if you type the awk command in the window that you used to create the split.awk file? The error message suggests that you don't have read access to the split.awk file in the new terminal window....
|
Same result, I also verified the standard OS X account (my account + the staff account + everyone) has both read/write access to split.awk.
** UPDATE ** so I tried using the touch command via terminal to create the file split.awk, then edited it's contents via CODA (still using the exact code you provided), and when I run the following command:
Code:
awk -f split.awk db.xml
I now get the following error:
Code:
awk: illegal statement
input record number 1, file db.xml
source line number 8