빅

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

· 2012-04-26 (목) 23:38:05 · 3010
 
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
 
 
 
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

8,187건
+
제목 글쓴이 날짜 조회
12-03-13 조회 3,022
12-03-12 조회 5,610
12-03-12 조회 3,092
12-03-12 조회 3,743
12-03-12 조회 3,492
12-03-12 조회 3,056
12-03-12 조회 1만
12-03-12 조회 3,426
12-03-12 조회 4,063
12-03-12 조회 3,044
12-03-12 조회 3,417
12-03-12 조회 3,313
12-03-12 조회 4,244
12-03-12 조회 5,857
12-03-12 조회 3,832
12-03-12 조회 5,648
12-03-12 조회 3,860
12-03-12 조회 6,266
12-03-11 조회 3,752
12-03-11 조회 3,197
12-03-11 조회 4,134
12-03-11 조회 4,943
12-03-11 조회 3,838
12-03-11 조회 3,814
12-03-11 조회 5,485
12-03-10 조회 3,492
12-03-10 조회 3,072
12-03-10 조회 3,982
12-03-10 조회 3,096
12-03-09 조회 7,444
12-03-09 조회 3,186
12-03-09 조회 3,594
12-03-09 조회 3,192
12-03-09 조회 3,204
12-03-09 조회 3,406
12-03-09 조회 4,179
12-03-08 조회 3,869
12-03-08 조회 3,757
12-03-08 조회 4,031
12-03-08 조회 6,151
12-03-08 조회 3,069
12-03-08 조회 4,151
12-03-08 조회 4,054
12-03-07 조회 2,970
12-03-07 조회 3,128
12-03-07 조회 2,807
12-03-06 조회 1.1만
12-03-06 조회 3,273
12-03-06 조회 4,324
12-03-06 조회 3,868
12-03-06 조회 3,208
12-03-06 조회 2,958
12-03-06 조회 6,379
12-03-06 조회 3,044
12-03-05 조회 3,138
12-03-04 조회 4,355
12-03-03 조회 3,738
12-03-03 조회 3,869
12-03-03 조회 3,413
12-03-03 조회 3,388
12-03-02 조회 3,207
12-03-02 조회 3,504
12-03-02 조회 3,341
12-03-02 조회 4,279
12-03-02 조회 3,438
12-03-02 조회 5,185
12-03-02 조회 3,062
12-03-02 조회 4,709
12-03-01 조회 5,219
12-03-01 조회 6,562
12-03-01 조회 3,371
12-02-29 조회 3,585
12-02-29 조회 4,064
12-02-29 조회 3,689
12-02-29 조회 3,721
12-02-29 조회 5,503
12-02-28 조회 3,657
12-02-28 조회 3,487
12-02-28 조회 3,649
12-02-28 조회 3,627
12-02-28 조회 3,253
12-02-27 조회 4,492
12-02-27 조회 4,348
12-02-27 조회 4,109
12-02-27 조회 3,547
12-02-27 조회 3,345
12-02-27 조회 3,070
12-02-27 조회 4,246
12-02-27 조회 5,165
12-02-27 조회 3,910
12-02-26 조회 4,164
12-02-26 조회 3,590
12-02-26 조회 3,626
12-02-26 조회 3,776
12-02-26 조회 3,490
12-02-26 조회 3,406
12-02-26 조회 3,351
12-02-26 조회 3,708
12-02-26 조회 3,823
12-02-26 조회 3,451