Skip to content

Instantly share code, notes, and snippets.

@aspen-roller
Created December 2, 2020 17:14
Show Gist options
  • Save aspen-roller/37e8b54a8b723ac12d023a2b396b8689 to your computer and use it in GitHub Desktop.
Save aspen-roller/37e8b54a8b723ac12d023a2b396b8689 to your computer and use it in GitHub Desktop.
remove _id from mongoexport dump #mongo
// dump.json is the result of a mongoexport using --jsonArray
cat dump.json | sed '/"_id":/s/"_id":[^,]*,//' > new-dump.json
// Regex for global replace
"_id":{[^,]+,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment