![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python/perl/shell
文章平均质量分 51
chengyurebecca
这个作者很懒,什么都没留下…
展开
-
使用sed和cut的一些小例子
关于SED: 修改第23行的内容:sed -i '23s/Applications/reb_app/g' reb_test.txt 删除最初三行:sed -i '1,3d' reb_test.txt 显示第二行:sed -n '2p' reb_test.txt 显示一个文件中1/3/5行中每行第1~5个字符:sed -n "1p;3p;5p" reb_t原创 2014-11-28 16:17:19 · 628 阅读 · 0 评论 -
Error in perl matching
We got this error by running: my $str = "reb,cheng"; $str = ~ s/,//; print $str, "\n"; seems everything is okay, but why? Here is the error message: C:\Rebecca\script\perl>perl status_v0.2原创 2015-01-04 13:40:06 · 362 阅读 · 0 评论 -
How to get all the members in user group by using LDAP in Perl?
About LDAP: LDAP stands for Lightweight Directory Access Protocol. It is usually used to fetch (and sometimes update) data in a directory of people. Using Net::LDAP module in Perl can provide a way原创 2015-01-04 14:05:26 · 907 阅读 · 0 评论 -
A easy example to tell you what is "2>&1" in Perl
A easy example to tell you what is "2>&1" in Perl原创 2015-01-22 17:09:20 · 760 阅读 · 0 评论 -
How to debug in Perl ?
If it is a small program, you can use this way: C:\Rebecca\script\perl>perl -d calculate.pl Loading DB routines from perl5db.pl version 1.39_10 Editor support available. Enter h or 'h h'原创 2015-01-22 11:19:18 · 723 阅读 · 0 评论 -
How to show Chinese character by using Perl?
You need to usemodule: Unicode::Map Where to get it? -http://search.cpan.org/~mschwartz/Unicode-Map-0.112/Map.pm Download Unicode-Map-0.112.tar.gz How to install it? -unzip the file andgo原创 2015-01-22 09:20:54 · 1132 阅读 · 0 评论 -
How to integrate LDAP in Perl?
If you try to use LDAP by adding "use Net::LDAP;"in your Perl script by you didn't have LDAP installed, you may probably get the following similar errors: C:\Rebecca\script\perl>perl status.pl Can't原创 2014-12-23 09:33:06 · 484 阅读 · 0 评论 -
Python小知识总结1
学习python时记录的一些知识点: Set #非常有用啊,直接去除重复元素,缺点是输出结果没有排序 >>> list = ['c', 'b', 'b', 'b', 'd', 'b', 'c', 'a', 'a'] >>> b = set(list) >>> b set(['a', 'c', 'b', 'd']) >>> c = [i for i in b] >>> c原创 2014-11-27 10:10:14 · 401 阅读 · 0 评论 -
Perl 注释方法
1. 单行注释 # 2.多行注释 用 =pod原创 2014-11-13 14:12:56 · 773 阅读 · 0 评论 -
用shell脚本在linux下删除和替换文件
几种常用的文件替换用法: 查找并替换文件名: find ./ -name "*.pyc" -exec rename pyc pyc1 {} \; #将后缀为pyc的文件替换为后缀pyc1 查找并替换文件里的内容: grep -rl bin ./ | xargs sed -i "s/bin/bina/g" #将当前目录下文件中bin的字符串替换为bina 删除文原创 2014-11-27 09:43:16 · 538 阅读 · 0 评论 -
python/perl/shell在windows下的安装
亲们想自己本地玩玩脚本么,下载一个呗: Python: 1.下载: http://www.python.org/download/ 2.设置环境变量 3.检查是不是安装好了: 在windows cmd下运行python Perl: 1. 下载active perl,哪里都有,官网地址:http://www.activestate.com/ 2.检查是不是安装好了:原创 2014-11-27 14:12:34 · 704 阅读 · 0 评论 -
Shell内部变量
$0:命令含命令所在的路径。 $#:传递给程序的总的参数数目。 $?:Shell程序在Shell中退出的情况,正常退出返回0,反之为非0值。 $*:传递给程序的所有参数组成的字符串。 Example: ! /bin/bash echo "program name is $0" echo "parameter passed to this program $#" echo "原创 2014-11-27 17:32:05 · 374 阅读 · 0 评论 -
Python知识总结2
产生随机数: Import random Random.random() 关于复制函数: Shutil.copyfile() Copy.copy() and copy.deepcopy() 1. copy.copy 浅拷贝 只拷贝父对象,不会拷贝对象的内部的子对象。 2. copy.deepcopy 深拷贝 拷贝对象及其子对象 a = [1, 2, 3, 4, ['a原创 2014-11-27 10:15:24 · 421 阅读 · 0 评论 -
Python/Perl/Shell - 注释-声明-运行
Something really basic: 开头: Shell #!/bin/bash perl: #!/usr/bin/perl python: #! usr/bin/python 注释: perl 单行: # 多行: =pod comments =cut python 单行:# 多行:''' comments'''原创 2014-11-27 16:43:00 · 495 阅读 · 0 评论 -
有用的python学习资料link,就两个,推荐!!
python简明编程:#里面很多小例子,跟着做做,很基本。天下代码一大抄,但是基本功一定要好啊。。 http://sebug.net/paper/python/index.html python: 从新手到高手:#目前还不是高手,但是比《简明》要深奥了许多。。 http://sebug.net/paper/books/dive-into-python/ 个人感觉比一些文库里面的原创 2014-11-26 17:20:12 · 475 阅读 · 0 评论 -
How to generate exe for your PERL script?
The way I am using is PAR Packer. 1. Downloadmodule PAR Packer: http://search.cpan.org/~rschupp/PAR-Packer-1.024/lib/PAR/Packer.pm 2. InstallPAR Packer: 2.1 Unzipthe *.tar 2.2 Go to原创 2015-01-06 09:05:25 · 1244 阅读 · 1 评论