어쩌라구..?? ㅡㅡa..

Posted
Filed under Linux/tip
텍스트 인코딩 명령어기
iconv -f=<원문인코딩> -t=<출력인코딩> inputName -o=outputName


파일 인코딩 변경 스크립트
#!/bin/sh
mkdir out
for FILE in *.php
do
iconv -f=EUC-KR -t=utf8 $FILE > "./out/$FILE"
done

파일의 인코딩을 변경할때 주의할점이 있는데,
리다이렉션이나 -o 옵션을 써서 변경된 내용을 저장하고자 할때
원본 파일이름을 그대로 쓰면 절대로 안된다. 파일 내용이 날아가버리기 때문이다.

반드시 다른 파일로 저장한 후 원본 파일을 삭제하거나 하고
변경된 파일을 원래 파일로 돌려주어야 한다.

입력 파일과 촐력파일을 같은 파일로 지정했을경우
파일이 사라지지는 않지만 용량이 0으로 변해버리는걸 보게 될것이다. ㅠㅠ..
2006/03/30 12:45 2006/03/30 12:45
Posted
Filed under Linux/vi
원래 소스는 다른데서 업어와서
내 필요와 기호에 따라 이리저리 선택하고 설정해서 쓰는 파일이다.

실제로 내가 안 쓰는 옵션도 있지만 주석으로 막혀있고,
그것들도 언젠가 필요할때가 올 것이다.

set nocompatible
" source $VIMRUNTIME/vimrc_example.vim

" set nu
syntax on
filetype on

"set tabstop=2
set shiftwidth=2
set softtabstop=2
set backspace=indent
set expandtab

au BufNewFile,BufReadPost Makefile set sw=4 sts=0 noexpandtab
au BufNewFile,BufReadPost *.py set ts=4 sw=4 sts=0 noexpandtab

set nowrap
"set cinoptions=>s:0=s(0W0g0hsi2s
set cindent
set ignorecase
set smartcase
set nohlsearch
set incsearch

colo pablo
"colo koehler
"colo elflord
"colo torteiocharset=utf8
"colo delek

"colo billw
"colo darkblack
"colo dante
"colo sean

"set bg=dark
" set backupdir=~/.vim.backup
" set tw=72
" set fileencodings=utf8
"set csprg=/usr/bin/cscope
" set path=.,~/
" set path=.,~/data,~/data/ani
" lang ko_KR

" let g:winManagerWindowLayout = 'TodoList,FileExplorer|BufExplorer'

" runtime ftplugin/man.vim

" 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

"set tags+=./.tags
"set tags+=/usr/include/GL/tags
"set tags+=/usr/src/linux-source-2.6.15/tags
"/usr/include/linux/tags


" ctags commands
if version >= 500

func! Sts()
     let st = expand("<cword>")
     exe "sts ".st
endfunc
nmap ,st :call Sts()<CR>

func! Tj()
     let st = expand("<cword>")
     exe "tj ".st
endfunc
nmap ,tj :call Tj()<CR>

endif


" Java commands
func! Jc()
     let jc = expand("%")
     exe "!javac ".jc
endfunc
nmap ,jc :call Jc()<CR>

func! Jr()
     let jr = expand("%:r")
     exe "!java ".jr
endfunc
nmap ,jr :call Jr()<CR>



nmap ,b1 :b!1<CR>
nmap ,b2 :b!2<CR>
nmap ,b3 :b!3<CR>
nmap ,b4 :b!4<CR>
nmap ,b5 :b!5<CR>
nmap ,b6 :b!6<CR>
nmap ,b7 :b!7<CR>
nmap ,b8 :b!8<CR>
nmap ,b9 :b!9<CR>
nmap ,bn :bn!<CR>
nmap ,bp :bp!<CR>

map ,n :cn<CR>
map ,p :cp<CR>
map ,l :cl<CR>
map ,w :cw<CR>

map ,ma :w<CR>:make<CR>

"set gfn=curier\ 10
set gfn=Bitstream\ Vera\ Sans\ Mono\ 10
set nohls
set nobackup
set noswapfile


2009년 9월 21일 수정
2006/02/23 17:37 2006/02/23 17:37
Posted
Filed under Linux/tip
convmv 명령으로 변경 가능하고,

쉘 스크립트를 이용하여 변경 가능하다.
파일 이름을 찾아 파이프로 iconv로 보내 변환시키고,
그 결과를 mv를 이용하여 변환한다.

쉘 스크립트 예제
#!/bin/sh

for OLDNAME in `find . -name "*"`; do
  NEWNAME=`echo $OLDNAME | iconv -f euc-kr -t utf8`
  mv $OLDNAME $NEWNAME
done

스크립트 내의 `기호는 작은따옴표가 아니라 탭키 위의 `문자이다. - 주의할것!

convmv 예제
convmv -f euc-kr -t utf-8 -r --nosmart --notest .
2006/02/22 03:30 2006/02/22 03:30
Posted
Filed under Linux/utility
svn 에서 update를 받기 전에 업데이트 받을 목록을 보는 방법이다.
이 명령을 실행했을때 *표시가 있는 파일이 업데이트 될 파일이다.
그러나 업데이트 결과 충돌이 발생할지는 알 수 없다.

svn st -u


옵션 없는 명령만으로는 내가 수정하여 svn에 반영할 목록만 얻을 수 있고,
변경사항이 실제로 내 소스트리에 적용되지 않은채 업데이트 할 목록을 얻을 방법은 없다.
2006/02/15 14:11 2006/02/15 14:11