上一页 1 ··· 7 8 9 10 11 12 13 14 15 下一页
摘要: sed -n '100,200p' file.txt #提取文件file.txt第100行到第200行的内容 sed 's/$/test/' file.txt #在行尾添加字符串test,$代表行尾 阅读全文
posted @ 2019-01-22 17:08 c++11 阅读(2723) 评论(0) 推荐(0)
摘要: cut 语法 cut -d 分隔符 -f 列索引 阅读全文
posted @ 2019-01-22 17:03 c++11 阅读(2473) 评论(0) 推荐(0)
摘要: path=/dir1/dir2/dir3/test.txt echo ${path##*/} 获取文件名 test.txtecho ${path##*.} 获取后缀 txt#不带后缀的文件名temp=${path##*/}echo ${temp%.*} test#获取目录echo ${path%/* 阅读全文
posted @ 2019-01-22 16:47 c++11 阅读(7532) 评论(0) 推荐(0)
摘要: 1.使用while 2.使用for 阅读全文
posted @ 2019-01-22 16:39 c++11 阅读(493) 评论(0) 推荐(0)
摘要: file1="1.txt" file2="2.txt" lines=`cat $file1 | wc -l` for ((i=1;i<=$lines;i++)) do line1=`awk 'NR=="'$i'"{print $0}' $file1` line2=`awk 'NR=="'$i'"{print $0}' $file2` if [[ $line1 == $line2... 阅读全文
posted @ 2019-01-15 17:45 c++11 阅读(4037) 评论(0) 推荐(0)
摘要: string="hell|ttt|sss|2222" OLD_IFS="$IFS" IFS="|" array=($string) IFS="$OLD_IFS" for var in ${array[@]} do echo $var done 阅读全文
posted @ 2019-01-15 17:36 c++11 阅读(4386) 评论(0) 推荐(0)
摘要: 1.使用grep 2. 使用操作符~ 3. 使用通配符* 阅读全文
posted @ 2019-01-15 17:27 c++11 阅读(74251) 评论(0) 推荐(2)
摘要: 1. 读取文件的第一行:head -n +1 file.txt 读取文件的最后一行: tail -n -1 file.txt echo 12:30:55 | cut -d: -f 1 结果为12,意思为将字符串12:30:55以:符号进行拆分,输出索引为1的值。 -d后跟以什么字符进行拆分, -f 阅读全文
posted @ 2019-01-10 17:16 c++11 阅读(14054) 评论(0) 推荐(0)
摘要: boost库的signal所实现的模式被命名为信号至插槽,当对应的信号被发出时,相关联的插槽即被执行。 boost::signal被实现为一个模板函数,具有被用作为事件处理器的函数的签名,该签名也是它的模板参数。上例中,只有签名为void()的函数才可以被成功关联至信号s。当信号s被触发时,func 阅读全文
posted @ 2019-01-10 16:54 c++11 阅读(850) 评论(0) 推荐(0)
摘要: 函数对象是指那些可以被传入到其它函数或是从其它函数返回的一类函数。 1. boost::bind bind提供了一个机制,是函数与几乎不限数量的参数一起使用,就可以得到指定签名的函数。bind会复制传递给它的参数。 add()函数要求两个参数,两个参数都必须传递给boost::bind()。第一个参 阅读全文
posted @ 2019-01-09 15:16 c++11 阅读(560) 评论(0) 推荐(0)
上一页 1 ··· 7 8 9 10 11 12 13 14 15 下一页