Skip to content

Instantly share code, notes, and snippets.

@linhmtran168
Created February 19, 2016 03:00
Show Gist options
  • Save linhmtran168/878a0d663c634f1f8966 to your computer and use it in GitHub Desktop.
Save linhmtran168/878a0d663c634f1f8966 to your computer and use it in GitHub Desktop.
Awk to parse mecab result
BEGIN {
first_line=1;
idx=1;
max_words=100;
}
{
if (index($4,"名詞") == 1)
if (first_line == 1) {
printf "%s", toupper($1);
first_line=0;
idx++;
} else {
if ((idx % max_words) == 1) {
printf "\n%s", toupper($1);
} else {
printf " %s", toupper($1);
}
if (idx == max_word){
idx = 1;
} else {
idx++;
}
}
}
END {print ""}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment