빅

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

· 2012-04-26 (목) 23:38:05 · 2970
 
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-05-10 조회 2,888
12-05-10 조회 3,577
12-05-09 조회 4,022
12-05-09 조회 6,273
12-05-08 조회 3,254
12-05-08 조회 3,473
12-05-08 조회 3,092
12-05-08 조회 2,912
12-05-08 조회 2,937
12-05-08 조회 3,315
12-05-08 조회 4,503
12-05-07 조회 2,983
12-05-07 조회 4,157
12-05-07 조회 4,272
12-05-07 조회 4,510
12-05-07 조회 3,177
12-05-06 조회 3,466
12-05-06 조회 3,093
12-05-05 조회 3,187
12-05-05 조회 3,072
12-05-05 조회 2,974
12-05-04 조회 3,124
12-05-04 조회 3,153
12-05-04 조회 3,321
12-05-04 조회 4,040
12-05-03 조회 2,882
12-05-03 조회 3,140
12-05-03 조회 2,990
12-05-03 조회 2,759
12-05-03 조회 3,124
12-05-03 조회 5,174
12-05-03 조회 4,283
12-05-03 조회 3,819
12-05-03 조회 2,867
12-05-02 조회 3,432
12-05-02 조회 4,230
12-05-02 조회 3,348
12-05-02 조회 3,416
12-05-02 조회 3,187
12-05-02 조회 3,284
12-05-02 조회 4,474
12-05-02 조회 2,909
12-05-02 조회 3,176
12-05-01 조회 4,638
12-05-01 조회 3,258
12-04-30 조회 2,768
12-04-30 조회 3,384
12-04-30 조회 3,254
12-04-30 조회 3,220
12-04-30 조회 3,537
12-04-30 조회 4,337
12-04-30 조회 3,225
12-04-28 조회 3,708
12-04-27 조회 2,800
12-04-27 조회 2,870
12-04-27 조회 2,783
12-04-26 조회 2,741
12-04-26 조회 3,098
12-04-26 조회 3,034
12-04-26 조회 2,706
12-04-26 조회 3,030
12-04-26 조회 3,639
12-04-26 조회 2,909
12-04-26 조회 3,574
12-04-26 조회 2,634
12-04-26 조회 2,971
12-04-26 조회 2,705
12-04-26 조회 2,950
12-04-26 조회 2,712
12-04-26 조회 3,137
12-04-26 조회 3,181
12-04-26 조회 2,991
12-04-26 조회 4,847
12-04-26 조회 2,725
12-04-26 조회 2,977
12-04-26 조회 2,790
12-04-26 조회 3,437
12-04-26 조회 3,119
12-04-26 조회 3,824
12-04-26 조회 4,125
12-04-26 조회 3,373
12-04-25 조회 5,364
12-04-25 조회 3,636
12-04-25 조회 3,019
12-04-25 조회 4,414
12-04-25 조회 4,849
12-04-25 조회 2,530
12-04-25 조회 2,843
12-04-25 조회 2,698
12-04-25 조회 2,752
12-04-25 조회 2,718
12-04-25 조회 2,945
12-04-24 조회 4,069
12-04-24 조회 2,588
12-04-24 조회 2,494
12-04-24 조회 2,738
12-04-24 조회 2,665
12-04-24 조회 2,567
12-04-24 조회 2,942
12-04-24 조회 2,958