- 博客(2)
- 收藏
- 关注
原创 MacOS sed对文件中匹配的行进行替换
例:替换 test.txt文件中 以"HHH"开头的行 为"hello world"linux:sed -i "/^HHH/c\hello world" test.txt-i: 表示直接对文件进行修改macOS:sed -i ".bk" "s/^HHH.*/hello world/g" test.txt匹配行时需要使用正则表达式:'.'表示匹配任意字符,'*'表示匹配零次或...
2019-12-12 11:33:09 1601 1
原创 统计字符串中子字符串的个数
使用strstr函数循环查询字符串进行统计#include <stdio.h>#include <string.h>/** * 功能:统计母串p_str包含子串p_child_str的个数 * 入参:p_str:母串 * p_child_str:需要统计的子串 * 返回值:-1 - 入参未NULL,-2 - 子串长度为0,其他 - 统计的个数 **/in...
2018-07-16 15:35:13 3754
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人