빅

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

· 2012-04-26 (목) 23:38:05 · 3022
 
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-08-02 조회 3,914
12-08-02 조회 3,829
12-08-01 조회 4,804
12-08-01 조회 4,696
12-07-31 조회 9,592
12-07-31 조회 3,837
12-07-31 조회 3,386
12-07-31 조회 3,174
12-07-31 조회 3,458
12-07-30 조회 3,640
12-07-30 조회 3,675
12-07-30 조회 3,326
12-07-30 조회 3,793
12-07-30 조회 4,229
12-07-29 조회 3,565
12-07-29 조회 3,289
12-07-29 조회 3,639
12-07-29 조회 4,227
12-07-27 조회 3,322
12-07-26 조회 4,882
12-07-26 조회 3,792
12-07-26 조회 3,399
12-07-26 조회 3,658
12-07-26 조회 4,079
12-07-25 조회 4,180
12-07-25 조회 3,326
12-07-24 조회 4,211
12-07-24 조회 3,682
12-07-23 조회 5,158
12-07-22 조회 3,683
12-07-22 조회 3,583
12-07-21 조회 3,471
12-07-21 조회 4,237
12-07-21 조회 3,201
12-07-20 조회 4,447
12-07-20 조회 3,748
12-07-20 조회 3,493
12-07-20 조회 3,403
12-07-20 조회 1만
12-07-19 조회 3,579
12-07-19 조회 3,407
12-07-19 조회 4,785
12-07-19 조회 4,275
12-07-19 조회 3,275
12-07-19 조회 3,082
12-07-19 조회 4,023
12-07-19 조회 3,534
12-07-19 조회 3,979
12-07-19 조회 5,632
12-07-19 조회 3,559
12-07-18 조회 3,357
12-07-18 조회 5,276
12-07-18 조회 3,558
12-07-18 조회 3,674
12-07-17 조회 4,399
12-07-17 조회 4,399
12-07-17 조회 3,598
12-07-17 조회 3,286
12-07-17 조회 4,160
12-07-17 조회 3,651
12-07-16 조회 3,984
12-07-16 조회 3,647
12-07-16 조회 3,839
12-07-16 조회 3,322
12-07-16 조회 3,306
12-07-16 조회 3,208
12-07-16 조회 4,564
12-07-15 조회 3,626
12-07-15 조회 4,345
12-07-15 조회 3,572
12-07-15 조회 3,550
12-07-15 조회 3,359
12-07-15 조회 3,831
12-07-15 조회 3,717
12-07-15 조회 3,565
12-07-15 조회 3,677
12-07-15 조회 4,270
12-07-15 조회 3,848
12-07-15 조회 4,192
12-07-15 조회 7,125
12-07-15 조회 3,757
12-07-15 조회 5,250
12-07-14 조회 3,912
12-07-14 조회 4,407
12-07-14 조회 3,461
12-07-14 조회 3,310
12-07-13 조회 8,505
12-07-13 조회 3,735
12-07-13 조회 3,698
12-07-12 조회 7,457
12-07-12 조회 4,434
12-07-12 조회 5,119
12-07-12 조회 4,584
12-07-11 조회 3,865
12-07-11 조회 3,578
12-07-11 조회 3,542
12-07-11 조회 3,152
12-07-11 조회 3,596
12-07-10 조회 1만
12-07-10 조회 5,773