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,043
13년 전 조회 771
13년 전 조회 889
13년 전 조회 798
13년 전 조회 660
13년 전 조회 775
13년 전 조회 852
13년 전 조회 920
13년 전 조회 1,735
13년 전 조회 441
13년 전 조회 817
13년 전 조회 590
13년 전 조회 393
13년 전 조회 848
13년 전 조회 2,858
13년 전 조회 1,926
13년 전 조회 1,487
13년 전 조회 447
13년 전 조회 1,076
13년 전 조회 1,918
13년 전 조회 1,052
13년 전 조회 1,078
13년 전 조회 813
13년 전 조회 991
13년 전 조회 1,990
13년 전 조회 491
13년 전 조회 856
13년 전 조회 2,150
13년 전 조회 972
13년 전 조회 536
13년 전 조회 978
13년 전 조회 814
13년 전 조회 874
13년 전 조회 1,137
13년 전 조회 1,929
13년 전 조회 1,051
13년 전 조회 1,412
13년 전 조회 509
13년 전 조회 570
13년 전 조회 497
13년 전 조회 446
13년 전 조회 741
13년 전 조회 790
13년 전 조회 469
13년 전 조회 725
13년 전 조회 1,311
13년 전 조회 535
13년 전 조회 1,346
13년 전 조회 415
13년 전 조회 655
13년 전 조회 431
13년 전 조회 669
13년 전 조회 517
13년 전 조회 858
13년 전 조회 907
13년 전 조회 794
13년 전 조회 2,640
13년 전 조회 415
13년 전 조회 677
13년 전 조회 584
13년 전 조회 1,075
13년 전 조회 806
13년 전 조회 1,448
13년 전 조회 1,795
13년 전 조회 1,139
13년 전 조회 3,010
13년 전 조회 1,289
13년 전 조회 669
13년 전 조회 2,090
13년 전 조회 2,531
13년 전 조회 392
13년 전 조회 525
13년 전 조회 423
13년 전 조회 523
13년 전 조회 465
13년 전 조회 662
13년 전 조회 1,911
13년 전 조회 385
13년 전 조회 385
13년 전 조회 529
13년 전 조회 497
13년 전 조회 389
13년 전 조회 701
13년 전 조회 643
13년 전 조회 399
13년 전 조회 414
13년 전 조회 1,381
13년 전 조회 652
13년 전 조회 1,037
13년 전 조회 411
13년 전 조회 1,012
13년 전 조회 538
13년 전 조회 400
13년 전 조회 666
13년 전 조회 2,174
13년 전 조회 846
13년 전 조회 1,520
13년 전 조회 431
13년 전 조회 459
13년 전 조회 710
🐛 버그신고