在Shell里面判断字符串是否为空分类:Linux shell2011-12-28 23:1815371人阅读评论(0)收藏举报shell主要有以下几种方法:echo “$str”|awk '{print length($0)}'expr length “$str”echo “$str”|wc -c...
分类:
系统相关 时间:
2015-05-18 20:10:26
阅读次数:
174
语法(3)方法定义调用参数返回模块引入模块写模块模块名称dir()方法定义语法 def 方法名(参数):返回值 return 没有指定返回值的方法,默认返回空值 None 。代码def say(who, dosth): ''' 谁做什么 ''' print who + ' '...
分类:
编程语言 时间:
2015-05-18 20:09:50
阅读次数:
138
字符串类型验证ctype_alnum— 做字母和数字字符检测ctype_alpha— 做纯字符检测ctype_cntrl— 做控制字符检测ctype_digit— 做纯数字检测ctype_graph— 做可打印字符串检测,空格除外ctype_lower— 做小写字符检测ctype_print— 做可...
分类:
Web程序 时间:
2015-05-18 18:09:44
阅读次数:
135
一个标准的守护进程的启动脚本:
#! /bin/sh
WHOAMI=`whoami`
PID=`ps -u $WHOAMI | gerp mydaemond | awk '{print $1}'`
if (test "$1" = "") then
echo "mydaemond [start][stop][version]"
exit 0
fi
if ( test "$1" = "...
分类:
系统相关 时间:
2015-05-18 14:47:18
阅读次数:
194
简介grep (global search regular expression(RE) and print out the line,全面搜索正则表达式并把行打印出来)是一种强大的文本搜索工具,它能使用正则表达式搜索文本,并把匹配的行打印出来。Unix的grep家族包括grep、egrep和fgr...
分类:
其他好文 时间:
2015-05-18 14:24:21
阅读次数:
221
代码如下:awk '{if(2==NR){gsub(/.*/, 300, $5)}print}' list.txt将文件list.txt的第2行第5列的值替换为300
分类:
其他好文 时间:
2015-05-18 12:46:11
阅读次数:
325
awk -F'\x1' '{if($5 ~/99000537588688/ && $8 ~/6W2o63/){print $0}}' /home/james/logs/game_logs/20140819/prefix_* | awk -F'\x3' '{print $2}' | awk -F'\....
分类:
其他好文 时间:
2015-05-18 12:44:18
阅读次数:
111
数组差集--array_diff()://array_diff():返回两个函数的差集(在返回数组中,键名保持不变)$a1=array(1=>"Dog",2=>"Horse");$a2=array(3=>"Horse",4=>"Dog",5=>"Fish");print_r(array_diff($...
分类:
编程语言 时间:
2015-05-18 10:39:08
阅读次数:
145
对以下代码进行编译:int main(){ int a[] = {1,2,3}; return 0;}$ gcc -g arrays.c -o arrays$ gdb arrays(gdb) break main(gdb) run(gdb) next1)可以使用 print 显示内容, ...
分类:
数据库 时间:
2015-05-18 10:28:51
阅读次数:
274
题目描述
The gray code is a binary numeral system where two successive values differ in only one bit.
Given a non-negative integer n representing the total number of bits in the code, print the se...
分类:
其他好文 时间:
2015-05-18 09:12:13
阅读次数:
118