Shell 要点记录
来源:互联网 发布:aws centos 编辑:程序博客网 时间:2024/06/18 14:19
1. 循环处理文件的每一行:
cat ./myfile | while read line ; do if [[ ${line::1} == "#" ]]; then continue fi # remove space and empty line line=${line// /} if [[ "$line" == "" ]] ;then continue fi ...done
2. 字符串处理
2.1 删除左边的字符(#)
${var#*xx}
2.2 删除右边的字符(%)
${var%xx*}
2.3 删除左边的字符(尽量多匹配)(##)
${var##*xx}
2.4 删除右边的字符(尽量多匹配)(%%)
${var%%xx*}
2.5 按长度截取(从左开始)
${var:start:length}# length从start数${var:start:-length}# length从最右数
阅读全文
0 0
- Shell 要点记录
- shell 编程要点
- shell 脚本编程要点
- Linux Shell学习要点
- div+css 要点记录
- 记录一些要点
- CSDN讲座要点记录
- java 要点记录
- 面向对象要点记录
- android面试要点记录
- MySQL必知必会,要点记录
- Apache 配置文件要点记录
- C++ Java要点记录
- C++ Java要点记录
- C++ Java要点记录
- Java学习要点记录
- Android学习要点记录
- xmpp学习要点记录
- 【SpringMVC-004】idea创建SpringMVC项目傻瓜教程-REST简介
- hdu6012Lotus and Horticulture离散化线性取最大值
- Ubuntu 16.04+OpenFace的配置和简单人脸检测
- Java并发编程:线程池的使用
- Superchaeger注册码(激活码)
- Shell 要点记录
- Unity中Socket和多线程导致Editor和程序卡住解决
- OpenGL学习——入门篇 第二章 基础实例2-3 RGBA颜色和索引色
- No sql_connection parameter is established
- 常见类---BigInteger类
- stm32 定时器 通用定时器
- 网页布局基础
- WampServer安装及切换语言
- LeetCode Merge Two Sorted Lists C++