빅

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

· 2012-04-26 (목) 23:38:05 · 3026
 
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-07-10 조회 3,715
12-07-10 조회 4,452
12-07-10 조회 4,750
12-07-09 조회 7,162
12-07-09 조회 3,495
12-07-09 조회 4,921
12-07-09 조회 3,416
12-07-09 조회 3,787
12-07-09 조회 3,632
12-07-09 조회 3,342
12-07-09 조회 1.3만
12-07-09 조회 3,290
12-07-09 조회 4,319
12-07-09 조회 3,491
12-07-09 조회 3,484
12-07-09 조회 4,729
12-07-08 조회 4,633
12-07-08 조회 4,662
12-07-07 조회 5,577
12-07-07 조회 3,684
12-07-06 조회 3,346
12-07-06 조회 3,518
12-07-06 조회 4,808
12-07-06 조회 4,089
12-07-06 조회 3,888
12-07-06 조회 3,988
12-07-06 조회 3,577
12-07-06 조회 4,175
12-07-06 조회 3,550
12-07-06 조회 3,927
12-07-06 조회 3,968
12-07-06 조회 4,377
12-07-06 조회 3,892
12-07-05 조회 4,139
12-07-05 조회 3,492
12-07-05 조회 3,568
12-07-05 조회 3,572
12-07-05 조회 3,969
12-07-05 조회 3,477
12-07-05 조회 3,932
12-07-05 조회 3,495
12-07-05 조회 3,525
12-07-04 조회 3,631
12-07-04 조회 3,599
12-07-04 조회 4,511
12-07-04 조회 3,847
12-07-04 조회 3,936
12-07-04 조회 4,459
12-07-03 조회 3,850
12-07-03 조회 3,089
12-07-03 조회 3,437
12-07-03 조회 4,146
12-07-03 조회 3,606
12-07-03 조회 3,397
12-07-02 조회 3,462
12-07-02 조회 5,610
12-07-02 조회 4,306
12-07-02 조회 4,141
12-07-02 조회 3,531
12-07-02 조회 3,420
12-07-02 조회 3,161
12-07-01 조회 3,625
12-06-30 조회 3,644
12-06-30 조회 5,896
12-06-30 조회 3,650
12-06-29 조회 3,856
12-06-29 조회 3,501
12-06-29 조회 3,461
12-06-29 조회 3,435
12-06-29 조회 3,495
12-06-29 조회 3,835
12-06-29 조회 5,421
12-06-29 조회 5,840
12-06-29 조회 3,914
12-06-28 조회 3,982
12-06-28 조회 3,455
12-06-28 조회 4,454
12-06-27 조회 3,465
12-06-27 조회 3,474
12-06-27 조회 3,481
12-06-27 조회 3,786
12-06-27 조회 3,512
12-06-26 조회 3,949
12-06-26 조회 3,691
12-06-26 조회 3,380
12-06-26 조회 5,069
12-06-25 조회 4,024
12-06-25 조회 3,870
12-06-24 조회 3,983
12-06-23 조회 3,671
12-06-22 조회 3,405
12-06-22 조회 3,353
12-06-22 조회 4,307
12-06-22 조회 3,862
12-06-22 조회 3,538
12-06-22 조회 8,707
12-06-22 조회 3,361
12-06-21 조회 3,373
12-06-21 조회 3,367
12-06-21 조회 3,503