Skip to content

Instantly share code, notes, and snippets.

@ctrlcctrlv
Last active June 19, 2021 17:34
Show Gist options
  • Select an option

  • Save ctrlcctrlv/1fcc8fde5f313f0182c4c92829f077f8 to your computer and use it in GitHub Desktop.

Select an option

Save ctrlcctrlv/1fcc8fde5f313f0182c4c92829f077f8 to your computer and use it in GitHub Desktop.
#!/bin/bash
FN=lines2 # input file
OUTP=`(mecab -Oyomi | nkf -h1 -w | awk '{ORS="\n"; print $s "\t" NR;}' | sort) < "$FN"`;
OUTI=$(echo "$OUTP" | awk -F "\t" '{ if (ff != substr($s, 1, 1)) { ff=substr($s, 1, 1); print ff };'\
'{ system("sed "$NF"q\\;d '"$FN"'") }}');
OUTF=$(egrep -v '^[A-Za-z]+' <<< "$OUTI" && egrep '^[A-Za-z]+' <<< "$OUTI"); echo "$OUTF"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment