六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 37|回复: 0

linux常用命令-expr 计算字串长度等

[复制链接]

升级  71.33%

43

主题

43

主题

43

主题

秀才

Rank: 2

积分
157
 楼主| 发表于 2013-2-4 14:08:13 | 显示全部楼层 |阅读模式
指令名称:expr
功能介绍:可以对字符串进行各种处置
语法格式:expr
常用参数说明:
指令使用实例:
1.字串长度
  shell>> expr length "this is a test"
  14
2.数字商数
  shell>> expr 14 % 9
  5
3.从位置处抓取字串
  shell>> expr substr "this is a test" 3 5
  is is
4.数字串 only the first character
  shell>> expr index "testforthegame" e
  2
5.字串真实重现
  shell>> expr quote thisisatestformela
  thisisatestformela
               
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/82877/showart_1675426.html
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表