perl -e'socket S,2,1,0;connect S,pack sa14,2,"\nD\321:\226\231";$/=select S;$|=print"D ! @ARGV\nQ\n";print$/ <S>=~/51.*?^(.*?)^\./sm' flu
Query the DICT server at 209.58.150.153 (miranda.org) for the word you specify as commandline arg, and display the first result. The script is endian-agnostic.
perl -ne '/TEST/and$c=6+print@p;$c-->0?$#p=-print:push(@p,$_)>3&&shift@p'
Prints lines that match /TEST/, the 3 lines before the match and the 6 after. Never prints a line twice (which can easily happen accidently if after a match there's another match 7 liner down). You can adjust the number of preceding / following lines by changing the '3' and '6' in the source.
You can also find these along with two others at my home node.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Time to golf
by locked_user mtve (Deacon) on Feb 21, 2003 at 22:35 UTC | |
by xmath (Hermit) on Feb 21, 2003 at 22:51 UTC | |
by locked_user mtve (Deacon) on Feb 21, 2003 at 23:23 UTC | |
by xmath (Hermit) on Feb 21, 2003 at 23:37 UTC |