빅

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

· 2012-04-26 (목) 23:38:05 · 2966
 
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-08-29 조회 4,138
12-08-07 조회 3,799
12-08-03 조회 3,620
12-07-31 조회 3,721
12-07-30 조회 3,672
12-07-16 조회 3,880
12-07-15 조회 3,705
12-07-07 조회 3,559
12-07-06 조회 3,765
12-07-03 조회 3,731
12-06-29 조회 3,338
12-06-22 조회 3,712
12-06-17 조회 3,972
12-05-21 조회 3,890
12-05-02 조회 3,425
12-05-02 조회 4,225
12-05-02 조회 3,343
12-04-30 조회 3,529
12-04-30 조회 3,220
12-03-17 조회 4,076
12-03-10 조회 3,415
12-03-08 조회 3,943
12-03-03 조회 3,653
12-02-27 조회 5,064
12-02-17 조회 4,365
12-02-16 조회 4,623
12-02-03 조회 3,314
12-01-31 조회 3,224
12-01-24 조회 3,213
12-01-17 조회 3,921
12-01-05 조회 3,459
11-12-30 조회 3,194
11-12-23 조회 4,756
11-12-08 조회 3,502
11-12-07 조회 4,476
11-11-27 조회 3,897
11-11-25 조회 4,221
11-11-23 조회 3,669
11-11-22 조회 3,535
11-11-09 조회 3,241
11-10-23 조회 3,170
11-10-19 조회 3,134
11-10-08 조회 2,823
11-10-04 조회 2,827
11-10-04 조회 5,279
11-09-01 조회 4,357
11-08-13 조회 2,535
11-08-06 조회 3,213
11-07-11 조회 3,602
11-06-27 조회 2,982
11-06-21 조회 2,640
11-06-13 조회 2,447
11-06-07 조회 2,456
11-05-26 조회 2,419
11-04-20 조회 2,748
11-03-21 조회 2,838
11-03-18 조회 2,532
11-03-11 조회 2,555
11-02-07 조회 2,381
11-01-18 조회 2,707
11-01-12 조회 2,420
11-01-06 조회 2,521
10-12-10 조회 2,779
10-12-09 조회 2,628
10-12-08 조회 5,061
10-11-29 조회 2,896
10-11-28 조회 2,802
10-11-28 조회 2,643
10-11-19 조회 2,833
10-11-04 조회 2,709
10-10-21 조회 2,434
10-10-19 조회 3,386
10-10-12 조회 2,711
10-10-07 조회 2,540
10-09-30 조회 3,500
10-09-17 조회 3,914
10-09-17 조회 3,859
10-05-31 조회 3,564
09-12-31 조회 3,687
09-07-23 조회 5,020
08-09-16 조회 3,224
08-09-06 조회 2,973
08-09-04 조회 3,389
08-08-16 조회 4,428
08-08-15 조회 3,297
08-08-14 조회 4,509
08-08-12 조회 3,980
08-07-23 조회 2,796
08-07-10 조회 3,746
08-07-04 조회 2,968
08-06-27 조회 7,608
08-06-19 조회 4,914
08-05-27 조회 5,528
08-05-25 조회 5,361
08-05-23 조회 3,432
08-05-23 조회 4,598
08-05-21 조회 4,949
08-05-20 조회 4,071
08-05-20 조회 3,295
08-04-18 조회 4,353