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,031
13년 전 조회 759
13년 전 조회 878
13년 전 조회 787
13년 전 조회 649
13년 전 조회 764
13년 전 조회 840
13년 전 조회 910
13년 전 조회 1,722
13년 전 조회 432
13년 전 조회 806
13년 전 조회 580
13년 전 조회 383
13년 전 조회 841
13년 전 조회 2,854
13년 전 조회 1,919
13년 전 조회 1,479
13년 전 조회 441
13년 전 조회 1,067
13년 전 조회 1,908
13년 전 조회 1,043
13년 전 조회 1,067
13년 전 조회 807
13년 전 조회 983
13년 전 조회 1,981
13년 전 조회 483
13년 전 조회 846
13년 전 조회 2,142
13년 전 조회 960
13년 전 조회 524
13년 전 조회 968
13년 전 조회 809
13년 전 조회 866
13년 전 조회 1,130
13년 전 조회 1,917
13년 전 조회 1,043
13년 전 조회 1,399
13년 전 조회 497
13년 전 조회 559
13년 전 조회 486
13년 전 조회 434
13년 전 조회 732
13년 전 조회 777
13년 전 조회 458
13년 전 조회 713
13년 전 조회 1,300
13년 전 조회 525
13년 전 조회 1,333
13년 전 조회 403
13년 전 조회 647
13년 전 조회 419
13년 전 조회 657
13년 전 조회 504
13년 전 조회 849
13년 전 조회 899
13년 전 조회 784
13년 전 조회 2,628
13년 전 조회 406
13년 전 조회 668
13년 전 조회 574
13년 전 조회 1,068
13년 전 조회 797
13년 전 조회 1,438
13년 전 조회 1,784
13년 전 조회 1,126
13년 전 조회 2,998
13년 전 조회 1,279
13년 전 조회 660
13년 전 조회 2,079
13년 전 조회 2,519
13년 전 조회 381
13년 전 조회 516
13년 전 조회 413
13년 전 조회 514
13년 전 조회 455
13년 전 조회 651
13년 전 조회 1,899
13년 전 조회 374
13년 전 조회 375
13년 전 조회 519
13년 전 조회 484
13년 전 조회 377
13년 전 조회 692
13년 전 조회 634
13년 전 조회 388
13년 전 조회 403
13년 전 조회 1,369
13년 전 조회 644
13년 전 조회 1,028
13년 전 조회 403
13년 전 조회 1,002
13년 전 조회 528
13년 전 조회 391
13년 전 조회 658
13년 전 조회 2,164
13년 전 조회 838
13년 전 조회 1,511
13년 전 조회 421
13년 전 조회 449
13년 전 조회 701
🐛 버그신고