最近遇到这样的问题,首先编译出现很多未定义的字符串的错误,于是想到,我可以把这些编译出现的错误重定向到一个文件中,然后把其中的字符串过滤出来,统一定义一下就行了,操作如下:
1) 交叉编译 app 工程,错误输出到 /tmp/k 文件中
make T=arm app > /tmp/k 2>&1
2) vi 打开该文件,用 substitute 替换以 ’ 字符开头到字符串结尾的串
:%s/\’ .\+$//g
3) 剔除重复行
sort -u /tmp/k > /tmp/good
疑问:
使用 sort -u 可以满足我的要求,但是它剔重后的结果已经重新排序了,有时候可能保持原来的顺序,怎么办呢?
8/24/2006
贴一下我的.vimrc
在linux下面写c/c++程序,我习惯使用vim,下面是我喜欢的配置,具体含义可以 :help
~/.vimrc:
" vim:shiftwidth=4:tabstop=4:expandtab
set background=dark
set nobackup
set nowritebackup
set autoindent
set showcmd
set showmatch
set formatoptions+=mM
set noincsearch
set hlsearch
set wrap
set wrapscan
set ruler
set shiftwidth=4
set tabstop=4
set showmode
set novisualbell
set nonumber
syntax on
" Key mapping to stop the search highlight
nmap :nohlsearch
imap :nohlsearch
"Ctrl+p 添加注释信息
map ^P o/*Comment by hzy
" 编辑当前文件所在目录下的另一个文件
" 使用表达式来从当前文件路径中解析出路径
if has("unix")
map ,e :e=expand("%:p:h") . "/"
else
map ,e :e=expand("%:p:h") . "\\"
endif
"setup cscope automaticly
if has("cscope")
set csprg=/usr/bin/cscope
set csto=0
set cst
set nocsverb
" add any database in current directory
if filereadable("cscope.out")
cs add cscope.out
" else add database pointed to by environment
elseif $CSCOPE_DB != ""
cs add $CSCOPE_DB
endif
set csverb
endif
~/.vimrc:
" vim:shiftwidth=4:tabstop=4:expandtab
set background=dark
set nobackup
set nowritebackup
set autoindent
set showcmd
set showmatch
set formatoptions+=mM
set noincsearch
set hlsearch
set wrap
set wrapscan
set ruler
set shiftwidth=4
set tabstop=4
set showmode
set novisualbell
set nonumber
syntax on
" Key mapping to stop the search highlight
nmap :nohlsearch
imap :nohlsearch
"Ctrl+p 添加注释信息
map ^P o/*Comment by hzy
" 编辑当前文件所在目录下的另一个文件
" 使用表达式来从当前文件路径中解析出路径
if has("unix")
map ,e :e
else
map ,e :e
endif
"setup cscope automaticly
if has("cscope")
set csprg=/usr/bin/cscope
set csto=0
set cst
set nocsverb
" add any database in current directory
if filereadable("cscope.out")
cs add cscope.out
" else add database pointed to by environment
elseif $CSCOPE_DB != ""
cs add $CSCOPE_DB
endif
set csverb
endif
订阅:
博文 (Atom)

