xiooli 写了:晕哦,都没人顶,没意思。。。
![:em66 :em66](./images/smilies/em66.gif)
![:em66 :em66](./images/smilies/em66.gif)
![:em66 :em66](./images/smilies/em66.gif)
xiooli 写了:晕哦,都没人顶,没意思。。。
可能是 ubuntu 上面 sort 的问题,arch 上无此错误。charleskao 写了:./booksearch.sh: line 9: uni2ascii:找不到命令
sort: 多字符标签 “¥”
./booksearch.sh: line 35: uni2ascii:找不到命令
./booksearch.sh: line 40: %12: 语法出错:此处需要运算符 (error token is "%12")
![]()
先:sudo apt-get install uni2ascii
然后在执行。
![]()
sort: 多字符标签 “¥”
不管如何,先顶再说!、
弱弱的问一句,sort的错误怎么回事?
代码: 全选
sudo apt-get install girlfriend
正在读取软件包列表... 完成
正在分析软件包的依赖关系树... 完成
有一些软件包无法被安装。
下列的信息可能会对解决问题有所帮助:
下列的软件包有不能满足的依赖关系:
girlfriend: 依赖: house但是它将不会被安装
girlfriend: 依赖: car但是它将不会被安装
house,car: 依赖: money但是它将不会被安装
E: 无法安装的软件包
代码: 全选
#!/usr/bin/perl -W
#=========get the books info from dangdang.com
#=========by keky, hitkeky[AT]gmail[DOT]com=========
#=========Usage: ./thisfile BOOKNAME=========
#=========Test Environment's encoding is utf8
#=========modules reserved: LWP Text::Iconv==
use strict;
use LWP;
use Text::Iconv;
my $key = $ARGV[0];
my $g2u = Text::Iconv->new('cp936','utf8'); ##ENCODING CONVERTER l change from cp936 2 utf8
my $u2g = Text::Iconv->new('utf8','gb2312');##ENCODING CONVERTER l change from utf8 2 gb2312
$key = $u2g->convert($key);
my $agent = LWP::UserAgent->new();
my $pages = &getMaxPage;
die "There is no result for your query!Please try again" unless $pages != -1; #there is no result
for( my $i = 1; $i <= $pages; ++$i)###print info for pages
{
my $pageInfo = &getPages( $i );
&printInfo( $pageInfo );
}
#####*************functions******################
sub removePoint{#remove the marks unusefull
my $tp = $_[0];
$tp =~ s/\<.*?\>//g;
return $tp;
}
sub printInfo{ #print the information needed
$_ = $_[0];
while( 1 ){
if( $_ =~ m/\<a.*pub_name.*/ ) #match the books
{
$_ = $'; #get the remained info
my $bookName = &removePoint( $& );#get bookName
print $bookName."\n";
if( $_ =~ m/\<h6\>.*\<\/h6\>/){ #match the prices of the books
$_ = $';
my $price = $&;
$price = &removePoint( $& );
print $price."\n";
}
}
else {
last;
}
}
}
sub getPages{
my $num = $_[0];
my $url = 'http://search.dangdang.com/book/search_pub.php?key='.$key.'&page='.$num.'&category=01';
my $response = $agent->get( $url );
#my $response = $agent->request( $request );
$response->is_success or die "$url: ".$response->message."\n";
my $tmp = $g2u->convert( $response->content);
return $tmp;
}
sub getMaxPage{ #get the pages' number
my $tmp = &getPages( 1 );
if( $tmp =~ m/maxPage=(\d+)/){
print "you are right!";
print "maxPage=:".$1."\n";
return $1;
}
return -1;
}