像排序这种事情,用C/C++可以写,但很麻烦,交给sort就好了,功能很强大的。
1、按照多个列排序(列间空格分开):
测试数据:
先按照第1列排序,再第2列的命令:
2011-11-20补充:必须加-s选项,表示stable sort,即两列排序互相不打扰。
$ cat ./test
1 x
5 8
1 a
$ sort -s -k 1 -k 2 ./test
1 a
1 x
5 [......]
像排序这种事情,用C/C++可以写,但很麻烦,交给sort就好了,功能很强大的。
1、按照多个列排序(列间空格分开):
测试数据:
先按照第1列排序,再第2列的命令:
2011-11-20补充:必须加-s选项,表示stable sort,即两列排序互相不打扰。
$ cat ./test
1 x
5 8
1 a
$ sort -s -k 1 -k 2 ./test
1 a
1 x
5 [......]
在Linux下,程序崩溃是很头疼的事情(其实Windows更是如此)。
我们可以生成core dump文件,并用gdb重现崩溃时的场景。
ulimit设置core dump开关和大小
ulimit -c unlimited
测试代码:
#include <stdio.h>
int main(int argc, char* argv[])
{
char * p = NULL;
*p = 123;
return 0;[......]
用Doxygen生成文档时,在处理一个图片时报如下错误:
sh: dot: not found
Problems running dot: exit code=127, command='dot', arguments='"/home/liheyuan/code/zookeeper-3.3.3/src/c/docs/html/zookeeper_8h__incl.dot" -Tpng -o "/home/liheyuan/code/zookeeper-3.3.3/src/c/docs/htm[......]
#!/usr/local/bin/php.cli
<?php
require_once './lib/swift_required.php';
//MySQL
$mysql_dbname = "db";
$mysql_user = "user";
$mysql_pass = "pass";
$mysql_file = "./xxx.sql";
$mysql_charset = "utf8";
system("mysqldump --default-character-[......]
Linux下的GNU Screen是很好的软件。
参考文章:《FAQ: How to scrollback in GNU SCREEN?》
如何滚动窗口呢?
首先,进入拷贝模式:
Ctrl + a + [
然后,如下方式移动:
(其实,此时上下左右,PageUp和PageDown都可以用的。)
h - Move the cursor left by one character
j - Move the cursor down by one line[......]