빅

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

· 2012-04-26 (목) 23:38:05 · 3008
 
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-04-24 조회 2,661
12-04-24 조회 2,724
12-04-24 조회 3,878
12-04-24 조회 3,019
12-04-24 조회 3,367
12-04-24 조회 2,758
12-04-24 조회 3,275
12-04-24 조회 2,802
12-04-24 조회 2,782
12-04-24 조회 2,966
12-04-24 조회 4,654
12-04-23 조회 3,104
12-04-23 조회 3,915
12-04-23 조회 2,726
12-04-23 조회 2,736
12-04-23 조회 3,007
12-04-23 조회 2,650
12-04-23 조회 3,688
12-04-23 조회 2,576
12-04-23 조회 2,650
12-04-23 조회 3,003
12-04-23 조회 2,811
12-04-23 조회 2,658
12-04-23 조회 2,855
12-04-23 조회 2,855
12-04-23 조회 2,612
12-04-23 조회 4,606
12-04-23 조회 3,634
12-04-23 조회 3,504
12-04-22 조회 2,634
12-04-22 조회 2,595
12-04-22 조회 2,677
12-04-22 조회 2,891
12-04-22 조회 2,693
12-04-22 조회 3,304
12-04-22 조회 3,344
12-04-22 조회 2,938
12-04-21 조회 3,196
12-04-21 조회 4,139
12-04-21 조회 4,574
12-04-21 조회 7,903
12-04-21 조회 2,716
12-04-21 조회 3,115
12-04-21 조회 2,614
12-04-21 조회 2,854
12-04-20 조회 3,656
12-04-20 조회 3,161
12-04-20 조회 2,832
12-04-20 조회 2,918
12-04-20 조회 2,714
12-04-20 조회 2,838
12-04-20 조회 3,967
12-04-20 조회 4,184
12-04-20 조회 3,043
12-04-20 조회 3,296
12-04-20 조회 4,396
12-04-20 조회 3,334
12-04-19 조회 3,390
12-04-19 조회 3,029
12-04-18 조회 4,456
12-04-18 조회 2,921
12-04-18 조회 3,154
12-04-17 조회 3,420
12-04-17 조회 3,591
12-04-17 조회 5,189
12-04-17 조회 5,490
12-04-17 조회 2,920
12-04-17 조회 3,421
12-04-16 조회 2,895
12-04-16 조회 3,616
12-04-16 조회 3,317
12-04-16 조회 3,200
12-04-16 조회 3,615
12-04-16 조회 2,847
12-04-16 조회 4,428
12-04-15 조회 4,005
12-04-14 조회 3,691
12-04-14 조회 3,084
12-04-14 조회 3,748
12-04-14 조회 3,799
12-04-13 조회 3,436
12-04-13 조회 4,632
12-04-13 조회 3,231
12-04-13 조회 2,957
12-04-13 조회 3,176
12-04-13 조회 6,254
12-04-12 조회 4,872
12-04-12 조회 3,405
12-04-11 조회 3,631
12-04-10 조회 5,114
12-04-10 조회 4,064
12-04-10 조회 3,176
12-04-09 조회 3,220
12-04-09 조회 4,791
12-04-09 조회 3,146
12-04-08 조회 3,483
12-04-07 조회 2,811
12-04-06 조회 2,960
12-04-06 조회 3,712
12-04-06 조회 5,492