파일명 바꾸기
글쓴이: goguma73 / 작성시간: 목, 2004/04/01 - 11:55오전
다음과 같은 파일이 있을때 일괄적으로 파일명을 변경하고 싶습니다.
파일명에 다음과 같은 문자가 들어가 있읐습니다.
[]'&와 스페이스가 들어가 있는 파일입니다.
[와 '와 &는 삭제하고 싶고
]와 스페이스는_로 변경하고 싶은데 rename가지고는 안되는것 같습니다.
[A] aaa.txt -> A__aaa.txt
[B C]aa'bb.txt -> BC_aabb.txt
[C]aaa&cc.txt -> C_aaacc.txt
로 변경하고 싶은데
어떤 유틸을 사용하면 될까요?
Forums:
더 복잡한 치환을 해야한다면 vi로 정규표현식을 써서 mv A B 목록을
더 복잡한 치환을 해야한다면 vi로 정규표현식을 써서 mv A B 목록을 만들고 :w !sh 하는 등의 꽁수를 써야겠지만, 치환 규칙이 다섯 개 뿐이라면 그냥 rename으로 단순하게 다섯 번 치환하셔도 될 것 같은데요.
--
자본주의, 자유민주주의 사회에서는 결국 자유마저 돈으로 사야하나보다.
사줄테니 제발 팔기나 해다오. 아직 내가 "사겠다"고 말하는 동안에 말이다!
단순무식하게 하기
단순무식하게 하기 싫어서 이기회에 awk,sed를 배워야 되나 고민했는데
rename이란 명령으로 간단히 해결되다니.. orz
rename이라는 명령어가
rename이라는 명령어가 있었군요.
그동안 awk로 작업했었는데.. 이렇게 간단히 되는것이었다니;;;;;
명령어도 너무도 당연한 이름이라서;; 당황스럽네요.
댓글 달기