빅

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

· 2012-04-26 (목) 23:38:05 · 2976
 
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,188건
+
제목 글쓴이 날짜 조회
12-09-05 조회 7,408
12-08-31 조회 5,853
12-08-30 조회 6,615
12-08-22 조회 1.2만
12-08-09 조회 5,641
12-08-02 조회 3,724
12-07-30 조회 4,081
12-07-15 조회 3,713
12-07-10 조회 3,618
12-07-06 조회 3,443
12-07-06 조회 3,428
12-07-03 조회 4,025
12-07-03 조회 3,517
12-07-02 조회 3,415
12-06-25 조회 3,912
12-06-20 조회 3,277
12-06-15 조회 3,864
12-06-14 조회 3,125
12-06-08 조회 3,916
12-06-07 조회 3,904
12-06-05 조회 5,777
12-06-05 조회 3,522
12-06-04 조회 3,856
12-06-01 조회 4,063
12-06-01 조회 4,792
12-06-01 조회 3,655
12-05-30 조회 3,192
12-05-28 조회 3,165
12-05-23 조회 3,276
12-05-18 조회 3,189
12-05-16 조회 3,233
12-05-16 조회 3,197
12-05-16 조회 4,465
12-05-16 조회 2,988
12-05-16 조회 2,976
12-05-16 조회 3,371
12-05-16 조회 3,133
12-05-16 조회 3,023
12-05-15 조회 3,196
12-05-15 조회 2,876
12-05-15 조회 3,120
12-05-15 조회 3,564
12-05-15 조회 3,290
12-05-15 조회 2,663
12-05-14 조회 2,708
12-05-14 조회 2,873
12-05-14 조회 2,846
12-05-14 조회 3,149
12-05-14 조회 2,970
12-05-11 조회 3,263
12-05-11 조회 2,795
12-05-11 조회 2,700
12-05-11 조회 2,806
12-05-11 조회 3,378
12-05-11 조회 2,558
12-05-10 조회 3,964
12-05-10 조회 2,808
12-05-10 조회 2,736
12-05-10 조회 2,879
12-05-10 조회 4,481
12-05-10 조회 2,519
12-05-10 조회 2,616
12-05-10 조회 2,479
12-05-10 조회 2,733
12-05-10 조회 3,182
12-05-10 조회 3,467
12-05-10 조회 2,707
12-05-10 조회 2,827
12-05-10 조회 3,321
12-05-10 조회 2,908
12-05-08 조회 3,101
12-05-08 조회 2,916
12-05-08 조회 2,941
12-05-08 조회 3,325
12-05-08 조회 4,511
12-05-03 조회 2,893
12-05-03 조회 3,001
12-05-03 조회 2,770
12-05-03 조회 3,824
12-05-03 조회 2,879
12-05-02 조회 2,916
12-04-27 조회 2,810
12-04-27 조회 2,875
12-04-27 조회 2,789
12-04-26 조회 2,750
12-04-26 조회 3,101
12-04-26 조회 3,040
12-04-26 조회 2,708
12-04-26 조회 3,034
12-04-26 조회 3,642
12-04-26 조회 2,914
12-04-26 조회 3,576
12-04-26 조회 2,638
12-04-26 조회 2,977
12-04-26 조회 2,711
12-04-26 조회 2,955
12-04-26 조회 2,716
12-04-26 조회 3,141
12-04-26 조회 3,183
12-04-26 조회 3,001