Skip to content

Instantly share code, notes, and snippets.

@xuchunyang
Created January 31, 2015 05:23
Show Gist options
  • Save xuchunyang/b293bd5f6c4465b9dd3c to your computer and use it in GitHub Desktop.
Save xuchunyang/b293bd5f6c4465b9dd3c to your computer and use it in GitHub Desktop.
Convert txt to csv (try to solve https://www.v2ex.com/t/166942)
➜ ~ cat words.txt
a[ei, ә]art.一个
an[әn, æn]art.一个
ability[ә'biliti]n.能力,才干
able['eibl]a.有才能的,能够的
➜ ~ gawk 'match($0, /(.*)\[(.*)\](.*)/, m) { print m[1], "\t", m[2], "\t", m[3] }' words.txt
a ei, ә art.一个
an әn, æn art.一个
ability ә'biliti n.能力,才干
able 'eibl a.有才能的,能够的
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment