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,072
13년 전 조회 801
13년 전 조회 920
13년 전 조회 835
13년 전 조회 684
13년 전 조회 808
13년 전 조회 883
13년 전 조회 952
13년 전 조회 1,766
13년 전 조회 473
13년 전 조회 851
13년 전 조회 616
13년 전 조회 417
13년 전 조회 872
13년 전 조회 2,887
13년 전 조회 1,948
13년 전 조회 1,524
13년 전 조회 472
13년 전 조회 1,102
13년 전 조회 1,945
13년 전 조회 1,083
13년 전 조회 1,109
13년 전 조회 835
13년 전 조회 1,027
13년 전 조회 2,019
13년 전 조회 516
13년 전 조회 887
13년 전 조회 2,179
13년 전 조회 1,001
13년 전 조회 563
13년 전 조회 1,014
13년 전 조회 837
13년 전 조회 898
13년 전 조회 1,167
13년 전 조회 1,957
13년 전 조회 1,085
13년 전 조회 1,441
13년 전 조회 544
13년 전 조회 597
13년 전 조회 523
13년 전 조회 473
13년 전 조회 769
13년 전 조회 820
13년 전 조회 499
13년 전 조회 758
13년 전 조회 1,335
13년 전 조회 566
13년 전 조회 1,381
13년 전 조회 447
13년 전 조회 684
13년 전 조회 450
13년 전 조회 690
13년 전 조회 549
13년 전 조회 885
13년 전 조회 929
13년 전 조회 820
13년 전 조회 2,668
13년 전 조회 446
13년 전 조회 700
13년 전 조회 608
13년 전 조회 1,091
13년 전 조회 835
13년 전 조회 1,470
13년 전 조회 1,822
13년 전 조회 1,164
13년 전 조회 3,038
13년 전 조회 1,310
13년 전 조회 688
13년 전 조회 2,119
13년 전 조회 2,563
13년 전 조회 418
13년 전 조회 544
13년 전 조회 448
13년 전 조회 550
13년 전 조회 480
13년 전 조회 689
13년 전 조회 1,940
13년 전 조회 412
13년 전 조회 419
13년 전 조회 555
13년 전 조회 518
13년 전 조회 414
13년 전 조회 727
13년 전 조회 664
13년 전 조회 419
13년 전 조회 438
13년 전 조회 1,409
13년 전 조회 668
13년 전 조회 1,061
13년 전 조회 429
13년 전 조회 1,035
13년 전 조회 566
13년 전 조회 426
13년 전 조회 689
13년 전 조회 2,204
13년 전 조회 868
13년 전 조회 1,537
13년 전 조회 458
13년 전 조회 484
13년 전 조회 737
🐛 버그신고