빅

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

· 2012-04-26 (목) 23:38:05 · 3027
 
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건
+
제목 글쓴이 날짜 조회
11-12-23 조회 4,150
11-12-23 조회 3,077
11-12-23 조회 4,902
11-12-23 조회 4,488
11-12-23 조회 2,833
11-12-23 조회 8,167
11-12-22 조회 3,156
11-12-22 조회 3,893
11-12-22 조회 3,641
11-12-22 조회 3,549
11-12-22 조회 3,748
11-12-21 조회 3,600
11-12-21 조회 3,381
11-12-21 조회 3,682
11-12-21 조회 4,065
11-12-21 조회 3,093
11-12-21 조회 3,584
11-12-21 조회 4,510
11-12-21 조회 4,333
11-12-21 조회 3,359
11-12-20 조회 3,831
11-12-19 조회 6,326
11-12-19 조회 3,001
11-12-19 조회 5,079
11-12-17 조회 3,938
11-12-17 조회 4,313
11-12-17 조회 3,594
11-12-16 조회 3,205
11-12-16 조회 3,375
11-12-15 조회 3,436
11-12-15 조회 3,543
11-12-15 조회 4,353
11-12-15 조회 5,648
11-12-15 조회 4,625
11-12-15 조회 3,295
11-12-15 조회 4,075
11-12-15 조회 4,243
11-12-14 조회 2,998
11-12-14 조회 4,420
11-12-14 조회 5,666
11-12-13 조회 4,238
11-12-13 조회 5,134
11-12-13 조회 6,144
11-12-13 조회 6,435
11-12-13 조회 4,838
11-12-12 조회 3,350
11-12-12 조회 3,653
11-12-12 조회 6,322
11-12-12 조회 4,720
11-12-12 조회 3,869
11-12-12 조회 6,220
11-12-11 조회 4,748
11-12-10 조회 2,858
11-12-10 조회 4,797
11-12-09 조회 2,890
11-12-09 조회 3,312
11-12-09 조회 4,230
11-12-09 조회 3,836
11-12-09 조회 4,052
11-12-09 조회 3,598
11-12-09 조회 4,549
11-12-09 조회 3,240
11-12-09 조회 3,387
11-12-09 조회 3,057
11-12-09 조회 3,871
11-12-08 조회 3,642
11-12-08 조회 3,606
11-12-08 조회 7,906
11-12-08 조회 4,222
11-12-08 조회 3,716
11-12-08 조회 2,944
11-12-08 조회 1.2만
11-12-08 조회 4,031
11-12-07 조회 2,901
11-12-07 조회 2,931
11-12-07 조회 3,981
11-12-07 조회 4,588
11-12-07 조회 4,049
11-12-07 조회 3,147
11-12-07 조회 4,464
11-12-06 조회 4,376
11-12-06 조회 5,718
11-12-06 조회 3,772
11-12-06 조회 3,694
11-12-05 조회 3,118
11-12-05 조회 3,411
11-12-05 조회 4,640
11-12-05 조회 3,392
11-12-05 조회 5,008
11-12-05 조회 2,958
11-12-05 조회 6,034
11-12-05 조회 3,161
11-12-05 조회 4,484
11-12-04 조회 5,808
11-12-04 조회 3,040
11-12-04 조회 3,408
11-12-03 조회 3,710
11-12-03 조회 3,075
11-12-03 조회 3,677
11-12-03 조회 3,579