빅

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

· 2012-04-26 (목) 23:38:05 · 3028
 
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건
+
제목 글쓴이 날짜 조회
11-08-06 조회 2,998
11-08-06 조회 2,666
11-08-06 조회 3,379
11-08-05 조회 3,053
11-08-05 조회 2,908
11-08-05 조회 3,248
11-08-05 조회 3,189
11-08-05 조회 2,655
11-08-05 조회 2,568
11-08-05 조회 2,355
11-08-05 조회 2,565
11-08-05 조회 3,406
11-08-05 조회 4,035
11-08-04 조회 4,077
11-08-04 조회 3,612
11-08-04 조회 3,092
11-08-04 조회 3,102
11-08-04 조회 2,964
11-08-04 조회 3,221
11-08-04 조회 2,201
11-08-04 조회 3,105
11-08-04 조회 2,241
11-08-04 조회 2,748
11-08-04 조회 2,523
11-08-04 조회 3,721
11-08-03 조회 2,430
11-08-03 조회 4,230
11-08-03 조회 2,767
11-08-03 조회 2,566
11-08-03 조회 4,624
11-08-03 조회 2,279
11-08-03 조회 2,639
11-08-03 조회 2,096
11-08-02 조회 2,607
11-08-02 조회 2,182
11-08-02 조회 2,937
11-08-02 조회 2,278
11-08-02 조회 2,780
11-08-02 조회 2,328
11-08-02 조회 2,240
11-08-01 조회 2,160
11-08-01 조회 3,061
11-08-01 조회 2,371
11-08-01 조회 2,220
11-08-01 조회 2,247
11-07-30 조회 2,981
11-07-30 조회 2,953
11-07-29 조회 2,142
11-07-29 조회 4,086
11-07-28 조회 2,022
11-07-28 조회 2,252
11-07-28 조회 4,847
11-07-27 조회 2,294
11-07-27 조회 2,728
11-07-27 조회 3,022
11-07-26 조회 2,156
11-07-26 조회 2,278
11-07-26 조회 2,340
11-07-26 조회 2,688
11-07-26 조회 2,268
11-07-26 조회 2,576
11-07-26 조회 4,522
11-07-26 조회 2,918
11-07-26 조회 2,331
11-07-26 조회 3,139
11-07-25 조회 2,429
11-07-25 조회 2,016
11-07-25 조회 3,914
11-07-25 조회 2,319
11-07-25 조회 2,443
11-07-23 조회 2,667
11-07-23 조회 2,606
11-07-23 조회 2,757
11-07-22 조회 2,171
11-07-22 조회 4,100
11-07-22 조회 2,432
11-07-21 조회 3,082
11-07-21 조회 2,619
11-07-21 조회 2,720
11-07-21 조회 2,386
11-07-20 조회 2,617
11-07-20 조회 2,184
11-07-20 조회 2,241
11-07-20 조회 2,993
11-07-20 조회 2,814
11-07-20 조회 2,602
11-07-20 조회 2,655
11-07-20 조회 3,559
11-07-20 조회 3,239
11-07-19 조회 2,175
11-07-19 조회 3,002
11-07-19 조회 2,873
11-07-19 조회 2,882
11-07-18 조회 2,411
11-07-18 조회 2,399
11-07-18 조회 2,365
11-07-18 조회 2,358
11-07-18 조회 3,038
11-07-18 조회 2,411
11-07-17 조회 2,655