일반적으로 Ctrl-R 옵션이나 Ctrl-H 옵션등으로
디렉토리 내의 모든 파일의 내용을 치환하는 것이 있다.

find ./ -exec grep "content" {} \; -exec sed -i "s/content/container/g" {} \;

[링크 : http://www.linux-forum.de/find-grep-replace-string-33557.html]

아무튼 위의 경우는 grep에 옵션이 들어가지 않았고, 모든 파일에 대해서 검색을 하므로
ctags 사용중에는 tags 파일까지 검색을 하게 된다.

크로스컴파일 목적으로 CC 라던가 LD 등을 고치려고 하면

find ./ -name Makefile -exec grep -w "= gcc" {} \; -exec sed -i "s/\= gcc/\= sh4-linux-gcc/g" {} \;

이렇게 find에 -name 옵션으로 파일을 지정하고(makefile 혹은 Makefile)
grep 옵션에 -w (Whole word matching) 으로 한정을 해주면 된다.

2010.02.04 추가
위의 예제는 "= gcc" 라고 들어있는 부분을 전체가 포함된 내용을 찾아 "= sh4-linux-gcc"로 변경해주는 것이다.
예를 들어 "= gcc3" 이런식으로 된 곳은  grep -w 옵션에 의해 무시된다.
그리고 tags 파일을 피하기 위해 find ./ -name Makefile 로 makefile에서만 수정을 하도록 제한한다.

2010/02/01 - [Linux] - grep에서 정확하게 찾기

Posted by 구차니
프로그램 사용/vi2010. 1. 29. 11:02
vi가 아쉬운 점은, 현재 편집중인 파일의 이름을 알수 없다는 점이다. (기본값으로)
아무튼 검색을 해보니 일시적으로 확인하려면
Ctrl-g나 :f로 하면 되지만 커서를 움직이면 사라진다.

이를 고정적으로 출력하기 위해서는 laststaus=2로 설정하면 된다.
다중창으로 편집중에는 출력되지만, 단일 창에서는 출력되지 않는다.

참고로 몇행:몇열 전체 % 라고 나오는 건 ruler 이다.
:set ruler
:set noruler로 토글가능하다.

Ctrl - G
:f
로 현재 편집중인 파일을 출력함

[링크 : http://kldp.org/node/92434]

:set laststatus=2

[링크 : http://vim.wikia.com/wiki/Displaying_status_line_always]

'laststatus' 'ls'    number    (default 1)
            global
            {not in Vi}
    The value of this option influences when the last window will have a
    status line:
        0: never
        1: only if there are at least two windows
        2: always
    The screen looks nicer with a status line if you have several
    windows, but it takes another screen line. |status-line|

[링크 : http://vimdoc.sourceforge.net/htmldoc/options.html#%27laststatus%27]

Posted by 구차니
프로그램 사용/vi2010. 1. 28. 17:27
여러개의 환경설정 파일이 존재 하지만,
가장 편하게 많은 사용자에게 적용하려면, 전역 환경변수를 수정하면된다.

/usr/share/vim/vimrc
    System wide Vim initializations.
~/.vimrc
    Your personal Vim initializations.

/usr/share/vim/gvimrc
    System wide gvim initializations.
~/.gvimrc
    Your personal gvim initializations.

[링크 : http://linux.die.net/man/1/vi]

Ubuntu 9.10에서는
set hlsearch
set nu
를 추가해주면 개발자가 편하게 사용할수있다.
Posted by 구차니
프로그램 사용/vi2010. 1. 28. 16:43
음.. 말이 애매한데,
Fedora에서는 vi에서 /검색어 로 검색을 하면, 화면상에 모든 검색어들이
하이라이트 처리되었다. 검색어가 블럭으로 선택되어 다르게 표시되어 눈에 띄었는데 우분투는 되지 않았다.

아무튼 페도라와 우분투의 설정을 비교해보니, hlsearch 라는 넘이 있는데
기본값은 off 라고 되어있다. 아마 페도라가 개발자가 많이 쓰다 보니 기본값을 on으로 했나보다.

'hlsearch'      off        no highlighting of search matches

[링크 : http://vimdoc.sourceforge.net/htmldoc/options.html]


:set hlsearch

:set nohlsearch

'프로그램 사용 > vi' 카테고리의 다른 글

vi 상태표시줄 설정 / 편집중인 파일이름 보기  (0) 2010.01.29
vi 환경설정 파일  (0) 2010.01.28
vi 파일 여러개 관리하기  (0) 2010.01.28
vi 에서 명령어 실행하기  (0) 2010.01.28
vi set commands  (0) 2010.01.27
Posted by 구차니
프로그램 사용/vi2010. 1. 28. 14:57
멀티윈도우 라고도 표기하는 녀석으로
텍스트에서 여러개 창으로 분할해서 사용하는 기능이다.

창 닫기
:q
ctrl - w, c(close)

새로운 창 열기 (가로 분할)
:new
ctrl - w, n

새로운 창 열기 (세로 분할)
ctrl - w, v(vertical)

새로운 창 열기 (파일명) - include 의 파일들을 따라간다.
ctrl - w, f(file)

새로운 창 열기 (ctags)
ctrl - w, ] (창을 열고 창에서 이동)
ctrl - ] (전체화면으로 이동)

창간 이동
ctrl - w, hjkl(좌/위/아래/우)
ctrl - w, tb(최상단=top / 최하단=bottom)
ctrl - w, w(순서대로 이동)

창을 전체 화면으로
:only

[링크 : http://pitfall.egloos.com/1310038]

2010.03.09 추가
수평창 크기 변경
ctrl - w, +/- (키패드는 안되는 듯?)
ctrl - w, n, +/- (숫자 입력후 +/-)

[링크 : http://www.ilug.or.kr/?mid=lec_tip&page=3&document_srl=42573]

2011.11.20 추가
수직창 크기 변경
ctrl - w, </>
[링크 : http://stackoverflow.com/.../with-vim-how-would-one-increase-the-vertical-split-window-size ]

2014.09.04 추가
새로운 창 열기 (가로 분할)
:split

새로운 창 열기 (세로 분할)
:vsplit

[링크 : http://nan1004au.tistory.com/41]
Posted by 구차니
프로그램 사용/vi2010. 1. 28. 12:07
vi 내부에서 외부 프로그램을 실행하는 방법으로
:! 명령어
를 입력하는 방법이 있다.

[링크 : http://www.joinc.co.kr/modules/moniwiki/wiki.php/Site/Vim/Documents/Tip/ExternalCommand]


$ vi ./src/modules/modules.c

ABOUT-NLS  INSTALL.win32  NEWS        bootstrap    config.status   doc       m4          rvlc      test              vlc.compile.log
AUTHORS    INSTALL.wince  README      compat       configure       extras    make-alias  share     toolbox
COPYING    MAINTAINERS    THANKS      compile      configure.ac    http.pre  modules     src       vlc
ChangeLog  Makefile       aclocal.m4  config.h     configure.help  include   po          stamp-h1  vlc-config
HACKING    Makefile.am    autotools   config.h.in  configure.log   libs      projects    svlc      vlc-config.in
INSTALL    Makefile.in    bin         config.log   cvlc            libtool   qvlc        tags      vlc-config.in.in

Press ENTER or type command to continue

VI 에서 편집중에
:! ls
를 실행한 결과
Posted by 구차니
프로그램 사용/gcc2010. 1. 27. 17:18
#if 문이라던가 각종 전처리기용 문구들은
여러가지 확장을 통해서 컴파일을 하기 때문에 source insight 등의 힘을 빌려도 분석하기 어려운 면이 있다.

일반적으로 컴파일러는 전처리기 - 컴파일 - 어셈블 - 링크 과정을 거치는데(아마도?)
전처리기 까지만 거친 결과를 stdout 으로 출력해준다.

$ man gcc
       -E  Stop after the preprocessing stage; do not run the compiler proper.
            The output is in the form of preprocessed source code, which is sent to the standard output.

           Input files which don't require preprocessing are ignored.

[링크 : http://linux.die.net/man/1/gcc]

$ cat test.c
#if 1
int test;
#else
int tt;
#endif

int main()
{
        return 0;
}

$ gcc -E test.c
# 1 "test.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "test.c"

int test;




int main()
{
 return 0;
}


#include 하는 모든 파일을 확장하기 때문에, #include <stdio.h>만 해도 내용이 엄청 길어진다.
그리고 줄단위로 처리하기 때문에 사라진 #if 문 대신 엔터만 남아 위와 같이 휑~하게 나왔다.


[링크 : http://cafe.naver.com/devctrl/949]
Posted by 구차니
프로그램 사용/vi2010. 1. 27. 15:42
set 명령어 모음을 보려면(설정된 값들)

:set all 하면 나온다.
우르르르 나오긴 하는데 음.. 머가 먼지는 ㄱ-

:set all
--- 옵션 ---
  aleph=224           foldclose=          mousemodel=extend   swapfile
noarabic              foldcolumn=0        mousetime=500       swapsync=fsync
  arabicshape         foldenable        nonumber              switchbuf=
noallowrevins         foldexpr=0          numberwidth=4       synmaxcol=3000
noaltkeymap           foldignore=#        omnifunc=           syntax=cpp
  ambiwidth=single    foldlevel=0         operatorfunc=       tabline=
noautochdir           foldlevelstart=-1 nopaste               tabpagemax=10
noautoindent          foldmethod=manual   pastetoggle=        tabstop=8
noautoread            foldminlines=1      patchexpr=          tagbsearch
noautowrite           foldnestmax=20      patchmode=          taglength=0
noautowriteall        formatexpr=       nopreserveindent      tagrelative
  background=light    formatoptions=tcq   previewheight=12    tagstack
nobackup              formatprg=        nopreviewwindow       term=xterm
  backupcopy=auto     fsync               printdevice=      notermbidi
  backupext=~       nogdefault            printencoding=      termencoding=
  backupskip=/tmp/*   helpheight=20       printfont=courier noterse
nobinary              helplang=ko         printmbcharset=     textauto
nobomb              nohidden              printmbfont=      notextmode
  bufhidden=          history=50          prompt              textwidth=0
  buflisted         nohkmap               pumheight=0         thesaurus=
  buftype=          nohkmapp              quoteescape=\     notildeop
  cdpath=,,         nohlsearch          noreadonly            timeout
  cedit=^F          noicon                redrawtime=2000     timeoutlen=1000
  charconvert=        iconstring=         remap             notitle
nocindent           noignorecase          report=2            titlelen=85
  cinoptions=         iminsert=0        norevins              titlestring=
  cmdheight=1         imsearch=0        norightleft         nottimeout
  cmdwinheight=7      includeexpr=        ruler               ttimeoutlen=-1
  columns=87        noincsearch           rulerformat=        ttybuiltin
nocompatible          indentexpr=         scroll=28           ttyfast
  completefunc=     noinfercase         noscrollbind          ttymouse=xterm2
noconfirm           noinsertmode          scrolljump=1        ttyscroll=999
nocopyindent          isprint=@,161-255   scrolloff=0         ttytype=xterm
  cpoptions=aABceFs   joinspaces        nosecure              undolevels=1000
  cscopepathcomp=0    key=                selectmode=         updatecount=200
  cscopeprg=cscope    keymap=             shell=/bin/bash     updatetime=4000
  cscopequickfix=     keymodel=           shellcmdflag=-c     verbose=0
nocscopetag           keywordprg=man      shellquote=         verbosefile=
  cscopetagorder=0    langmap=            shelltemp           virtualedit=
nocscopeverbose       langmenu=           shellxquote=      novisualbell
nocursorcolumn        laststatus=1      noshiftround          warn
nocursorline        nolazyredraw          shiftwidth=8      noweirdinvert
  debug=            nolinebreak         noshortname           whichwrap=b,s
nodelcombine          lines=57            showbreak=          wildchar=<Tab>
  dictionary=       nolisp              noshowcmd             wildcharm=0
nodiff              nolist              noshowfulltag         wildignore=
  diffexpr=           listchars=eol:$   noshowmatch         nowildmenu
  diffopt=filler      loadplugins         showmode            wildmode=full
nodigraph             magic               showtabline=1       wildoptions=
  display=            makeef=             sidescroll=0        window=56
  eadirection=both    makeprg=make        sidescrolloff=0     winheight=1
noedcompatible        matchtime=5       nosmartcase         nowinfixheight
  encoding=utf-8      maxcombine=2      nosmartindent       nowinfixwidth
  endofline           maxfuncdepth=100  nosmarttab            winminheight=1
  equalprg=           maxmem=254460     nospell               winwidth=20
noerrorbells          maxmemtot=254460    spellfile=          wrap
  esckeys             menuitems=25        spelllang=en        wrapmargin=0
  eventignore=      nomodeline            spellsuggest=best   wrapscan
noexpandtab           modelines=5       nosplitbelow          write
noexrc                modifiable        nosplitright        nowriteany
  fileformat=unix   nomodified            startofline         writebackup
  filetype=cpp        more                statusline=         writedelay=0
nofkmap               mouse=              suffixesadd=
  backspace=indent,eol,start
  backupdir=.,~/tmp,~/
  breakat= ^I!@*-+;:,./?
  casemap=internal,keepascii
  cinkeys=0{,0},0),:,0#,!^F,o,O,e
  cinwords=if,else,while,do,for,switch
  comments=s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-
  commentstring=/*%s*/
  complete=.,w,b,u,t,i
  completeopt=menu,preview
  define=^\s*#\s*define
  directory=.,~/tmp,/var/tmp,/tmp
  errorfile=errors.err
  errorformat=%*[^"]"%f"%*\D%l: %m,"%f"%*\D%l: %m,%-G%f:%l: (Each undeclared identifier
 is reported only once,%-G%f:%l: for each function it appears in.),%f:%l:%c:%m,%f(%l):%
m,%f:%l:%m,"%f"\, line %l%*\D%c%*[^ ] %m,%D%*\a[%*\d]: Entering directory `%f',%X%*\a[%
*\d]: Leaving directory `%f',%D%*\a: Entering directory `%f',%X%*\a: Leaving directory
`%f',%DMaking %*\a in %f,%f|%l| %m
  fileencoding=utf-8
  fileencodings=ucs-bom,utf-8,default,latin1
  fileformats=unix,dos
  fillchars=vert:|,fold:-
  foldmarker={{{,}}}
  foldopen=block,hor,mark,percent,quickfix,search,tag,undo
  foldtext=foldtext()
  formatlistpat=^\s*\d\+[\]:.)}\t ]\s*
  grepformat=%f:%l:%m,%f:%l%m,%f  %l%m
  grepprg=grep -n $* /dev/null
  guicursor=n-v-c:block,o:hor50,i-ci:hor15,r-cr:hor30,sm:block
  helpfile=/usr/share/vim/vim72/doc/help.txt
  highlight=8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMs
g,M:ModeMsg,n:LineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visua
l,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:Di
ffDelete,T:DiffText,>:SignColumn,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu
,=:PmenuSel,x:PmenuSbar,X:PmenuThumb,*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColum
n,.:CursorLine
  include=^\s*#\s*include
  indentkeys=0{,0},:,0#,!^F,o,O,e
  isfname=@,48-57,/,.,-,_,+,,,#,$,%,~,=
  isident=@,48-57,_,192-255
  iskeyword=@,48-57,_,192-255
  lispwords=defun,define,defmacro,set!,lambda,if,case,let,flet,let*,letrec,do,do*,defin
e-syntax,let-syntax,letrec-syntax,destructuring-bind,defpackage,defparameter,defstruct,
deftype,defvar,do-all-symbols,do-external-symbols,do-symbols,dolist,dotimes,ecase,etype
case,eval-when,labels,macrolet,multiple-value-bind,multiple-value-call,multiple-value-p
rog1,multiple-value-setq,prog1,progv,typecase,unless,unwind-protect,when,with-input-fro
m-string,with-open-file,with-open-stream,with-output-to-string,with-package-iterator,de
fine-condition,handler-bind,handler-case,restart-bind,restart-case,with-simple-restart,
store-value,use-value,muffle-warning,abort,continue,with-slots,with-slots*,with-accesso
rs,with-accessors*,defclass,defmethod,print-unreadable-object
  matchpairs=(:),{:},[:]
  maxmempattern=1000
  mkspellmem=460000,2000,500
  nrformats=octal,hex
  paragraphs=IPLPPPQPP TPHPLIPpLpItpplpipbp
  path=.,/usr/include,,
  printexpr=system('lpr' . (&printdevice == '' ? '' : ' -P' . &printdevice) . ' ' . v:f
name_in) . delete(v:fname_in) + v:shell_error
  printheader=%<%f%h%m%=페이지 %N
  printoptions=paper:a4
  rightleftcmd=search
  runtimepath=~/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim72,/
usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,~/.vim/after
  scrollopt=ver,jump
  sections=SHNHH HUnhsh
  selection=inclusive
  sessionoptions=blank,buffers,curdir,folds,help,options,tabpages,winsize
  shellpipe=2>&1| tee
  shellredir=>%s 2>&1
  shortmess=filnxtToO
  spellcapcheck=[.?!]\_[\])'"^I ]\+
  suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.
out,.toc
  tags=./tags,./TAGS,tags,TAGS
  titleold=빔을 날게 해 주셔서 고맙습니다
  viewdir=~/.vim/view
  viewoptions=folds,options,cursor
  viminfo='100,<50,s10,h



[링크 : http://www.eng.hawaii.edu/Tutor/vi.html]
Posted by 구차니
프로그램 사용/VLC2010. 1. 26. 17:56
Youtube의 Asteroid Impact (HD) 를 play 하는데 필요한 모듈을 캡쳐했다.



리눅스쪽이 녹색, 윈도우쪽이 파란색이다.
일단 눈에 띄는 차이점은, audio output과 video ouput 부분이다.

'프로그램 사용 > VLC' 카테고리의 다른 글

VLC cross compile시 오류 (vlc-1.0.4)  (0) 2010.02.03
VLC 1.0.4 cross compile + busybox  (0) 2010.02.02
VLC로 youtube 동영상 감상하기  (0) 2010.01.26
youtube mobile on VLC  (0) 2010.01.18
VLC compile [링크]  (0) 2010.01.15
Posted by 구차니
프로그램 사용/VLC2010. 1. 26. 13:43
youtube는 주소가 아래와 같이 http로 나온다.
http://www.youtube.com/watch?v=Hz86TsGx3fc


혹시나 해서 VLC의 네트워크 스트리밍플레이 기능에 주소를 넣었더니!!


알아서 잘 재생한다 OTL


http://youtube.com/get_video?video_id=Hz86TsGx3fc&t=vjVQa1PpcFPX_-4fVcvo3Rpy39pZ_nwt5-HPSBmsva0%3D
http://youtube.com/get_video?video_id=Hz86TsGx3fc&t=vjVQa1PpcFPs3v8rnDY3-mp1ptSqFzKAem6jcmYB2tY%3D&fmt=35

위의것은 기본 주소로 플레이한 주소이고
아래것은 기본 주소에 &fmt=35 옵션을 주어 플레이한 주소이다.
중간의 파란색은 token 값 같은데 플레이마다 변화되는듯 하다.

유튜브 페이지를 열어서 소스를 보니
    <script type="text/javascript">
        ...
        yt.setConfig({
            'SWF_ARGS':
                   ...
                   {"t": "vjVQa1PpcFPGZu0xo_69WU8f__RZMX6s3tda2xfxQ44%3D"},
                   ...
            });

이런식으로 "t" 변수에 값을 넣어준다.
다른 문서들에 비하면 "&t="를 찾아라고 하는데, 시간이 지나면서 내용이 변경된듯 하다.

아무튼, fmt=35로 하면 아래와 같이 h264로 재생이 된다.


[링크 : http://darksoft.co.kr/410]
[링크 : http://hallang.tistory.com/217]

'프로그램 사용 > VLC' 카테고리의 다른 글

VLC 1.0.4 cross compile + busybox  (0) 2010.02.02
의미는 없는 Linux / Windows VLC 차이  (0) 2010.01.26
youtube mobile on VLC  (0) 2010.01.18
VLC compile [링크]  (0) 2010.01.15
ffmpeg + AMR + x264 + VLC?  (0) 2010.01.14
Posted by 구차니