빅

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

· 2012-04-26 (목) 23:38:05 · 3016
 
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-05-26 조회 4,137
12-05-26 조회 3,468
12-05-26 조회 5,054
12-05-26 조회 3,999
12-05-26 조회 3,525
12-05-25 조회 3,687
12-05-25 조회 3,296
12-05-25 조회 3,199
12-05-25 조회 3,286
12-05-25 조회 3,408
12-05-25 조회 3,242
12-05-25 조회 3,318
12-05-25 조회 3,247
12-05-25 조회 4,059
12-05-25 조회 3,419
12-05-24 조회 3,031
12-05-24 조회 3,004
12-05-24 조회 3,387
12-05-24 조회 3,347
12-05-24 조회 4,699
12-05-24 조회 4,059
12-05-23 조회 3,361
12-05-23 조회 4,136
12-05-23 조회 3,340
12-05-23 조회 4,473
12-05-23 조회 3,634
12-05-22 조회 6,703
12-05-22 조회 3,951
12-05-22 조회 3,466
12-05-22 조회 3,247
12-05-21 조회 3,010
12-05-21 조회 4,005
12-05-21 조회 3,661
12-05-21 조회 5,209
12-05-20 조회 3,101
12-05-19 조회 3,485
12-05-19 조회 3,028
12-05-18 조회 3,085
12-05-18 조회 3,099
12-05-18 조회 3,661
12-05-18 조회 3,273
12-05-18 조회 3,495
12-05-18 조회 5,073
12-05-17 조회 4,117
12-05-17 조회 4,106
12-05-17 조회 4,027
12-05-17 조회 4,813
12-05-16 조회 3,301
12-05-16 조회 3,277
12-05-16 조회 4,546
12-05-16 조회 3,081
12-05-16 조회 3,072
12-05-16 조회 3,460
12-05-16 조회 3,225
12-05-16 조회 3,100
12-05-16 조회 3,200
12-05-16 조회 3,402
12-05-15 조회 3,584
12-05-15 조회 3,227
12-05-15 조회 4,190
12-05-15 조회 3,260
12-05-15 조회 2,939
12-05-15 조회 3,182
12-05-15 조회 3,623
12-05-15 조회 3,352
12-05-15 조회 2,737
12-05-15 조회 3,306
12-05-15 조회 3,748
12-05-14 조회 2,761
12-05-14 조회 2,932
12-05-14 조회 2,904
12-05-14 조회 3,206
12-05-14 조회 3,029
12-05-14 조회 3,194
12-05-13 조회 3,481
12-05-12 조회 3,650
12-05-11 조회 2,941
12-05-11 조회 3,308
12-05-11 조회 7,154
12-05-11 조회 3,342
12-05-11 조회 2,866
12-05-11 조회 2,781
12-05-11 조회 2,862
12-05-11 조회 3,436
12-05-11 조회 2,615
12-05-10 조회 4,006
12-05-10 조회 4,012
12-05-10 조회 2,858
12-05-10 조회 2,785
12-05-10 조회 2,931
12-05-10 조회 4,530
12-05-10 조회 2,568
12-05-10 조회 2,657
12-05-10 조회 2,524
12-05-10 조회 2,797
12-05-10 조회 3,248
12-05-10 조회 3,534
12-05-10 조회 2,782
12-05-10 조회 2,893
12-05-10 조회 3,395