Skip to content

Instantly share code, notes, and snippets.

@xecutioner
Created May 7, 2014 04:45
Show Gist options
  • Save xecutioner/6ceff4ee31f1e41ae825 to your computer and use it in GitHub Desktop.
Save xecutioner/6ceff4ee31f1e41ae825 to your computer and use it in GitHub Desktop.
answer
awk 'BEGIN { system("mkdir -p splitted/sub"++j) }
/<doc/{x="F"++i".xml";}{
if (i%5==0 ){
++i;
close("splitted/sub"j"/"x);
system("mkdir -p splitted/sub"++j"/");
}
else{
print > ("splitted/sub"j"/"x);
}
}' wiki_parsed.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment