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

· 13년 전 · 1060
 
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,537
13년 전 조회 1,252
13년 전 조회 1,349
13년 전 조회 1,269
13년 전 조회 1,132
13년 전 조회 1,254
13년 전 조회 1,296
13년 전 조회 1,376
13년 전 조회 2,225
13년 전 조회 888
13년 전 조회 1,293
13년 전 조회 1,015
13년 전 조회 810
13년 전 조회 1,314
13년 전 조회 3,278
13년 전 조회 2,367
13년 전 조회 1,944
13년 전 조회 893
13년 전 조회 1,509
13년 전 조회 2,367
13년 전 조회 1,481
13년 전 조회 1,528
13년 전 조회 1,267
13년 전 조회 1,446
13년 전 조회 2,433
13년 전 조회 891
13년 전 조회 1,269
13년 전 조회 2,609
13년 전 조회 1,427
13년 전 조회 974
13년 전 조회 1,440
13년 전 조회 1,257
13년 전 조회 1,313
13년 전 조회 1,568
13년 전 조회 2,398
13년 전 조회 1,477
13년 전 조회 1,901
13년 전 조회 941
13년 전 조회 976
13년 전 조회 921
13년 전 조회 856
13년 전 조회 1,157
13년 전 조회 1,199
13년 전 조회 897
13년 전 조회 1,127
13년 전 조회 1,700
13년 전 조회 921
13년 전 조회 1,748
13년 전 조회 852
13년 전 조회 1,061
13년 전 조회 845
13년 전 조회 1,063
13년 전 조회 914
13년 전 조회 1,254
13년 전 조회 1,332
13년 전 조회 1,182
13년 전 조회 3,040
13년 전 조회 822
13년 전 조회 1,056
13년 전 조회 949
13년 전 조회 1,449
13년 전 조회 1,170
13년 전 조회 1,869
13년 전 조회 2,211
13년 전 조회 1,563
13년 전 조회 3,463
13년 전 조회 1,691
13년 전 조회 1,051
13년 전 조회 2,516
13년 전 조회 2,948
13년 전 조회 785
13년 전 조회 868
13년 전 조회 817
13년 전 조회 907
13년 전 조회 815
13년 전 조회 1,050
13년 전 조회 2,278
13년 전 조회 770
13년 전 조회 743
13년 전 조회 899
13년 전 조회 856
13년 전 조회 745
13년 전 조회 1,072
13년 전 조회 1,019
13년 전 조회 765
13년 전 조회 772
13년 전 조회 1,794
13년 전 조회 999
13년 전 조회 1,398
13년 전 조회 724
13년 전 조회 1,372
13년 전 조회 889
13년 전 조회 749
13년 전 조회 1,055
13년 전 조회 2,574
13년 전 조회 1,207
13년 전 조회 1,875
13년 전 조회 760
13년 전 조회 814
13년 전 조회 1,069