这是使用 Wordnet 进行字典查找的命令行脚本:
#!/bin/bash
# Command line look up using Wordnet - command line dictionary
echo "Type in your word:"
read word
/usr/bin/curl -s -A 'Mozilla/4.0' 'http://wordnetweb.princeton.edu/perl/webwn?s='$word'&sub=Search+WordNet&o2=&o0=1&o7=&o5=&o1=1&o6=&o4=&o3=&h=' \
| html2text -ascii -nobs -style compact -width 500 | grep "*"
我输入“你好”这是输出:
Type in your word:
hello
**** Noun ****
* S:(n)hello, hullo, hi, howdy, how-do-you-do (an expression of greeting) "every morning they exchanged polite hellos"
我只想要 S: 之后的字符串,之前什么都没有。我想删除以下内容:
**** Noun ****
* S:
将其自行留作管道->
(n)hello, hullo, hi, howdy, how-do-you-do (an expression of greeting) "every morning they exchanged polite hellos"