빅

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

· 2012-04-26 (목) 23:38:05 · 3007
 
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-06 조회 3,049
12-04-06 조회 3,261
12-04-05 조회 3,685
12-04-05 조회 3,077
12-04-05 조회 4,724
12-04-05 조회 3,377
12-04-05 조회 4,063
12-04-04 조회 4,352
12-04-04 조회 3,995
12-04-03 조회 3,324
12-04-03 조회 3,901
12-04-03 조회 3,210
12-04-03 조회 2,943
12-04-02 조회 3,649
12-04-02 조회 3,356
12-04-01 조회 3,275
12-04-01 조회 3,113
12-04-01 조회 3,340
12-03-31 조회 3,194
12-03-31 조회 3,670
12-03-30 조회 3,280
12-03-30 조회 2,924
12-03-30 조회 3,596
12-03-30 조회 3,261
12-03-30 조회 3,946
12-03-30 조회 3,394
12-03-29 조회 6,146
12-03-29 조회 3,951
12-03-29 조회 4,688
12-03-29 조회 3,155
12-03-28 조회 2,750
12-03-28 조회 3,471
12-03-28 조회 4,393
12-03-28 조회 3,190
12-03-27 조회 4,686
12-03-27 조회 3,098
12-03-27 조회 3,488
12-03-26 조회 4,170
12-03-26 조회 3,560
12-03-26 조회 3,131
12-03-26 조회 3,865
12-03-26 조회 6,225
12-03-25 조회 2,816
12-03-25 조회 2,966
12-03-24 조회 3,039
12-03-24 조회 6,496
12-03-24 조회 3,664
12-03-24 조회 3,924
12-03-23 조회 3,877
12-03-23 조회 3,056
12-03-23 조회 2,949
12-03-23 조회 3,090
12-03-22 조회 3,943
12-03-22 조회 3,332
12-03-22 조회 3,581
12-03-22 조회 4,800
12-03-22 조회 3,283
12-03-22 조회 3,746
12-03-22 조회 3,632
12-03-22 조회 2,914
12-03-22 조회 5,825
12-03-22 조회 3,567
12-03-22 조회 5,118
12-03-21 조회 3,341
12-03-21 조회 3,133
12-03-21 조회 3,239
12-03-21 조회 2,927
12-03-21 조회 3,636
12-03-21 조회 3,623
12-03-21 조회 4,955
12-03-21 조회 6,508
12-03-21 조회 2,889
12-03-20 조회 5,695
12-03-20 조회 2,879
12-03-20 조회 3,405
12-03-20 조회 3,151
12-03-20 조회 3,408
12-03-20 조회 4,160
12-03-19 조회 3,632
12-03-19 조회 2,859
12-03-19 조회 3,544
12-03-18 조회 3,279
12-03-17 조회 3,592
12-03-17 조회 4,178
12-03-17 조회 3,399
12-03-16 조회 3,016
12-03-16 조회 4,170
12-03-16 조회 3,409
12-03-15 조회 3,023
12-03-15 조회 3,104
12-03-15 조회 3,422
12-03-15 조회 2,826
12-03-14 조회 4,048
12-03-14 조회 3,298
12-03-14 조회 3,364
12-03-14 조회 3,005
12-03-13 조회 3,661
12-03-13 조회 4,532
12-03-13 조회 2,883
12-03-13 조회 2,817