#!/usr/bin/perl use strict; use warnings; use utf8; use IO::File; my ($key, $dict) = @ARGV; $dict or die "usage: $0 key dict\n"; $dict = IO::File->new($dict, "r"); my (@lines, $line); while (defined ($line = $dict->getline)) { $line =~ s/^((.*?) ){6}//; push @lines, $line; } my %already; sub pr { print unless $already{$_}++; } for (@lines) { pr if /^$key /; } #for (@lines) { pr if /^$key/; } for (@lines) { pr if m{\) $key ?[/(]} }; for (@lines) { pr if /\b$key\b/; } for (@lines) { pr if /$key/; } #( #cut -d' ' -f7- $2 | grep "^$1 " ##cut -d' ' -f7- $2 | grep "^$1" #cut -d' ' -f7- $2 | grep ') '"$1"' \?[/(]' # '[^-A-Za-z0-9 ]' #cut -d' ' -f7- $2 | grep -w "$1" #cut -d' ' -f7- $2 | grep "$1" #) | uniqo