sed xargs 이용해서 파일 이름 일부분 변경하기

· 13년 전 · 1233
 
ls * | sed -e 'p;s/foo/bar/' | xargs -n2 mv
 
 
sed [OPTION]
 
  -e script, --expression=script
                 add the script to the commands to be executed
 
 
xargs [OPTION]
 
      --max-args=max-args, -n max-args
              Use at most max-args arguments per command line.  Fewer than max-args arguments will be used if the size (see the -s option)  is  exceeded,  unless
              the -x option is given, in which case xargs will exit.
              
              
bulk rename files with sed, one-liner
Renames all files in a directory named foo to bar.
foobar1 gets renamed to barbar1
barfoo2 gets renamed to barbar2
fooobarfoo gets renamed to barobarfoo
 
 
 
[root@oracle test1]# ls
footest1  testfoo1
 
[root@oracle test1]# ls * | sed -e 'p;s/foo/bar/' | xargs -n2 mv
[root@oracle test1]# ls
bartest1  testbar1
 
 
 
|
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

태그 필터 (최대 3개) 전체 개발자 소스 기타 mysql 팁자료실 javascript php linux flash 정규표현식 jquery node.js mobile 웹서버 os 프로그램 강좌 썸네일 이미지관련 도로명주소 그누보드5 기획자 견적서 계약서 기획서 마케팅 제안서 seo 통계 서식 통계자료 퍼블리셔 html css 반응형 웹접근성 퍼블리싱 표준화 반응형웹 홈페이지기초 부트스트랩 angularjs 포럼 스크린리더 센스리더 개발자톡 개발자팁 퍼블리셔톡 퍼블리셔팁 기획자톡 기획자팁 프로그램강좌 퍼블리싱강좌
+
제목 글쓴이 날짜 조회
13년 전 조회 1,727
13년 전 조회 1,447
13년 전 조회 1,529
13년 전 조회 1,447
13년 전 조회 1,307
13년 전 조회 1,458
13년 전 조회 1,475
13년 전 조회 1,570
13년 전 조회 2,397
13년 전 조회 1,077
13년 전 조회 1,452
13년 전 조회 1,215
13년 전 조회 992
13년 전 조회 1,474
13년 전 조회 3,449
13년 전 조회 2,558
13년 전 조회 2,116
13년 전 조회 1,067
13년 전 조회 1,711
13년 전 조회 2,528
13년 전 조회 1,658
13년 전 조회 1,711
13년 전 조회 1,453
13년 전 조회 1,621
13년 전 조회 2,608
13년 전 조회 1,080
13년 전 조회 1,440
13년 전 조회 2,793
13년 전 조회 1,594
13년 전 조회 1,152
13년 전 조회 1,639
13년 전 조회 1,437
13년 전 조회 1,510
13년 전 조회 1,765
13년 전 조회 2,582
13년 전 조회 1,632
13년 전 조회 2,110
13년 전 조회 1,114
13년 전 조회 1,163
13년 전 조회 1,083
13년 전 조회 1,032
13년 전 조회 1,353
13년 전 조회 1,368
13년 전 조회 1,077
13년 전 조회 1,315
13년 전 조회 1,892
13년 전 조회 1,127
13년 전 조회 1,940
13년 전 조회 1,019
13년 전 조회 1,234
13년 전 조회 1,011
13년 전 조회 1,240
13년 전 조회 1,083
13년 전 조회 1,419
13년 전 조회 1,485
13년 전 조회 1,344
13년 전 조회 3,199
13년 전 조회 991
13년 전 조회 1,235
13년 전 조회 1,104
13년 전 조회 1,597
13년 전 조회 1,341
13년 전 조회 2,040
13년 전 조회 2,371
13년 전 조회 1,709
13년 전 조회 3,669
13년 전 조회 1,861
13년 전 조회 1,207
13년 전 조회 2,669
13년 전 조회 3,109
13년 전 조회 942
13년 전 조회 1,043
13년 전 조회 974
13년 전 조회 1,056
13년 전 조회 968
13년 전 조회 1,201
13년 전 조회 2,446
13년 전 조회 921
13년 전 조회 922
13년 전 조회 1,052
13년 전 조회 1,015
13년 전 조회 921
13년 전 조회 1,223
13년 전 조회 1,169
13년 전 조회 925
13년 전 조회 929
13년 전 조회 1,961
13년 전 조회 1,155
13년 전 조회 1,538
13년 전 조회 850
13년 전 조회 1,505
13년 전 조회 1,022
13년 전 조회 899
13년 전 조회 1,197
13년 전 조회 2,727
13년 전 조회 1,331
13년 전 조회 2,022
13년 전 조회 887
13년 전 조회 962
13년 전 조회 1,206