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

 
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
 
 
 
|
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

+
제목 글쓴이 날짜 조회
13년 전 조회 1,183
13년 전 조회 902
13년 전 조회 1,019
13년 전 조회 927
13년 전 조회 782
13년 전 조회 908
13년 전 조회 968
13년 전 조회 1,053
13년 전 조회 1,876
13년 전 조회 576
13년 전 조회 955
13년 전 조회 715
13년 전 조회 521
13년 전 조회 978
13년 전 조회 2,981
13년 전 조회 2,048
13년 전 조회 1,628
13년 전 조회 572
13년 전 조회 1,209
13년 전 조회 2,052
13년 전 조회 1,186
13년 전 조회 1,196
13년 전 조회 940
13년 전 조회 1,130
13년 전 조회 2,116
13년 전 조회 607
13년 전 조회 978
13년 전 조회 2,277
13년 전 조회 1,099
13년 전 조회 663
13년 전 조회 1,110
13년 전 조회 934
13년 전 조회 1,000
13년 전 조회 1,254
13년 전 조회 2,061
13년 전 조회 1,188
13년 전 조회 1,536
13년 전 조회 645
13년 전 조회 692
13년 전 조회 631
13년 전 조회 579
13년 전 조회 872
13년 전 조회 921
13년 전 조회 605
13년 전 조회 858
13년 전 조회 1,430
13년 전 조회 663
13년 전 조회 1,480
13년 전 조회 536
13년 전 조회 780
13년 전 조회 567
13년 전 조회 783
13년 전 조회 638
13년 전 조회 979
13년 전 조회 1,031
13년 전 조회 922
13년 전 조회 2,767
13년 전 조회 545
13년 전 조회 805
13년 전 조회 708
13년 전 조회 1,178
13년 전 조회 930
13년 전 조회 1,568
13년 전 조회 1,918
13년 전 조회 1,268
13년 전 조회 3,132
13년 전 조회 1,414
13년 전 조회 781
13년 전 조회 2,217
13년 전 조회 2,662
13년 전 조회 516
13년 전 조회 641
13년 전 조회 549
13년 전 조회 651
13년 전 조회 562
13년 전 조회 777
13년 전 조회 2,037
13년 전 조회 520
13년 전 조회 507
13년 전 조회 658
13년 전 조회 615
13년 전 조회 508
13년 전 조회 831
13년 전 조회 761
13년 전 조회 523
13년 전 조회 519
13년 전 조회 1,514
13년 전 조회 760
13년 전 조회 1,159
13년 전 조회 517
13년 전 조회 1,124
13년 전 조회 654
13년 전 조회 520
13년 전 조회 787
13년 전 조회 2,307
13년 전 조회 961
13년 전 조회 1,636
13년 전 조회 553
13년 전 조회 596
13년 전 조회 829
🐛 버그신고