您的位置:首页 > 运维架构 > Linux

Linux系统下便捷使用中国知网的方式

2017-01-07 00:02 597 查看
本篇文章讲解在linux平台下合理使用中国知网的方式,包括:论文下载,文件名乱码处理等内容,并提供相应代码。

(1)论文下载

背景:由于cnki并未提供linux平台下的caj阅读器,同时使用模拟器运行caj阅读器则可能造成程序崩溃和内容乱码等的问题,使广大使用者深感痛楚,接下来讲解如何快捷下载pdf格式文档,而非cnki推荐的caj格式文档的方法。

1)进入浏览器插件管理页面,搜索:Greasemonkey,下载并安装油猴子浏览器插件。安装后请重启浏览器。



2)点击下方链接进入Greasemonkey脚本下载页面,浏览器将自动安装脚本。

https://greasyfork.org/scripts/18841-cnki-%E4%B8%AD%E5%9B%BD%E7%9F%A5%E7%BD%91-pdf-%E5%85%A8%E6%96%87%E4%B8%8B%E8%BD%BD/code/CNKI%20%E4%B8%AD%E5%9B%BD%E7%9F%A5%E7%BD%91%20PDF%20%E5%85%A8%E6%96%87%E4%B8%8B%E8%BD%BD.user.js

3)点击下载图标,可直接下载pdf格式文档,而非cnki所默认的caj格式文档。同时博硕士论文下载选项处出现PDF下载选项。



(2)文件名称乱码处理
Linux系统下可推荐 convmv 程序进行文件名编码格式转换。
首先安装并安装 convmv 程序,方式为:
aro@ZAKER:~$sudo apt install convmv

注:该方式适用于Ubuntu系统,其他Linux系统的下载方式与此类似。

以下为convmv的帮助文档:
CONVMV(1)

NAME
convmv -converts filenames from one encoding to another

SYNOPSIS
convmv[options] FILE(S) ... DIRECTORY(S)

OPTIONS
-f ENCODING
specifythe current encoding of the filename(s) from which should beconverted

-t ENCODING
specifythe encoding to which the filename(s) should be converted

--nosmart
bydefault convmv will detect if a filename is already UTF8 encoded andwill skip this file if conversion from some charset to UTF8 should beperformed. "--nosmart" will also force conversion to UTF-8for such files,
which might result in "double encoded UTF-8"(see section below).
--nosmart
bydefault convmv will detect if a filename is already UTF8 encoded andwill skip this file if conversion from some charset to UTF8 should beperformed. "--nosmart" will also force conversion to UTF-8for such files,
which might result in "double encoded UTF-8"(see section below).

使用方式较简单,可将大部分cnki下载文文件名进行编码转换。
使用方式为:

1)到达文件所在目录。

aro@ZAKER:~$cd ./file


2) 运行代码:

aro@ZAKER:~/file$convmv -r -f utf8 -t iso88591 * --nosmart && convmv -r -f gbk -t utf8 * --nosmart


以测试能够进行转化操作,同时在操作3进行之前请备份文件。

3)运行代码:

aro@ZAKER:~/file$convmv -r -f utf8 -t iso88591 * --notest --nosmart && convmv -r -f gbk -t utf8 * --notest --nosmart


以非测试的方式进行转化,注意这种方式可能会破坏文件。

以Ubuntu 16.04系统convmv 2.0程序下的使用方式为例:
aro@ZAKER:~$cd ./filearo@ZAKER:~/file$ls2_5_7_9_ËÄÏõ»ù_2_5__Ê¡ÂÔ__8µÄ·ÅÈȷֽⷴӦ¶¯Á¦Ñ§_Ó¢ÎÄ_ÕÔ·ïÆð.pdfaro@ZAKER:~/file$convmv -r -f utf8 -t iso88591 * --nosmart&& convmv -r -f gbk -t utf8 * --nosmartStarting a dry run without changes...mv"./ÐÂÒ»´ú¸ßËÙI_O»¥Á¬PCIExpress½Ó¿ÚÉè¼Æ_ºúÅô.2.pdf"
"./��һ������I_O����PCIExpress�ӿ�����_����.2.pdf"No changes to your files done. Would have converted 1 files in 0 seconds.Use --notest to finally rename the files.Starting a dry run without changes...Skipping, already UTF-8: ./ÐÂÒ»´ú¸ßËÙI_O»¥Á¬PCIExpress½Ó¿ÚÉè¼Æ_ºúÅô.2.pdfNo
changes to your filesdone. Would have converted 0 files in0 seconds.Use --notest to finally rename the files.aro@ZAKER:~/file$convmv -r -f utf8 -t iso88591 * --notest --nosmart&& convmv -r -f gbk -t utf8 * --notest --nosmartmv "./2_5_7_9_ËÄÏõ»ù_2_5__Ê¡ÂÔ__8µÄ·ÅÈȷֽⷴӦ¶¯Á¦Ñ§_Ó¢ÎÄ_ÕÔ·ïÆð.pdf"
"./2_5_7_9_������_2_5__ʡ��__8�ķ��ȷֽⷴӦ����ѧ_Ӣ��_�Է���.pdf"Ready! I converted1 files in 0 seconds.mv "./2_5_7_9_������_2_5__ʡ��__8�ķ��ȷֽⷴӦ����ѧ_Ӣ��_�Է���.pdf" "./2_5_7_9_四硝基_2_5__省略__8的放热分解反应动力学_英文_赵凤起.pdf"Ready! I converted 1 files in 0 seconds.aro@ZAKER:~/file$ls2_5_7_9_四硝基_2_5__省略__8的放热分解反应动力学_英文_赵凤起.pdf
同时注意单纯使用convmv -r -f gbk -t utf8 * --notest –nosmart或convmv -r -f utf8 -t iso88591 * --notest--nosmart命令并不能实现乱码问题的解决。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  linux 中国知网
相关文章推荐