Skip to content

Instantly share code, notes, and snippets.

@mRoca
Last active August 29, 2015 14:16
Show Gist options
  • Select an option

  • Save mRoca/4a6e09277fe8335db2f0 to your computer and use it in GitHub Desktop.

Select an option

Save mRoca/4a6e09277fe8335db2f0 to your computer and use it in GitHub Desktop.
xliff ids generator
<trans-unit id="([\w\.]*)">(\s*)<source>([\w\.]*)</source>
<trans-unit id="$3">$2<source>$3</source>
#!/bin/sh
# Add trans-unit ids in xliff files
# Usage : xliffid.sh myfile.xliff
awk '$0 = /<trans-unit id=".*">/ ? " <trans-unit id=\""++increment"\">" : $0' $1 > /tmp/xlifftmp
mv /tmp/xlifftmp $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment