2013年7月16日

linux中expr用法

摘要: 名称:expr ### 字串长度 shell>>exprlength "this is a test" 14 ### 数字商数 shell>> expr 14 % 9 5 ### 从位置处抓取字串 shell>> exprsubstr"this is a test" 3 5 is is ### 数字串 only the first character shell>> expr index "testforthegame" e 2 ### 字串真实重现 shell>> expr 阅读全文

posted @ 2013-07-16 21:17 yi_meng 阅读(2229) 评论(0) 推荐(0) 编辑

linux中sed中用s 替换中遇到的问题

摘要: sed替换时候不能用-n,只输出替换的行,为什么????比如:sed "2,4s/\"//g" /var/lib/status #可以输出但是:sed -n "2,4s/\"//g" /var/lib/status #什么也数不出来了问题:文件helloword,shroot@ubuntu:/home/dyx/linux 17:25:36 188# nl -b a helloword.sh 1 #!/bin/bash 2 echo "helloword!"; 3 echo "The first param 阅读全文

posted @ 2013-07-16 20:00 yi_meng 阅读(12393) 评论(1) 推荐(0) 编辑

linux中nl用法

摘要: linux 中nl 命令使用nl :添加行号打印-b: 指定行号指定的方式,主要有两种: -b a : 表示不论是否为空行,都同样列出行号 -b t : 如果有空行,则不列出那一行的行号-n: 列出行号的表示方法,主要有三种: -n ln : 行号在屏幕的左方显示 -n rn :行号在自己字段的最右边显示,且不加0 -n rz : 行号在自己字段的最右边显示,且加0-w :行号字段的占用的位数 阅读全文

posted @ 2013-07-16 16:40 yi_meng 阅读(623) 评论(0) 推荐(0) 编辑

linux中shell脚本中系统预先定义的变量

摘要: $0:脚本名称;$*:所有参数;$$:当前进程或者脚本的PID号;$!:后台运行的最后一个进程的PID号;$?:用于返回上一个命令是否成功。成功0,否则为非零;$#:参数个数;$@:所有参数 阅读全文

posted @ 2013-07-16 11:19 yi_meng 阅读(633) 评论(0) 推荐(0) 编辑

导航