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,052
13년 전 조회 778
13년 전 조회 899
13년 전 조회 805
13년 전 조회 665
13년 전 조회 784
13년 전 조회 860
13년 전 조회 929
13년 전 조회 1,742
13년 전 조회 449
13년 전 조회 824
13년 전 조회 596
13년 전 조회 402
13년 전 조회 853
13년 전 조회 2,867
13년 전 조회 1,930
13년 전 조회 1,495
13년 전 조회 456
13년 전 조회 1,086
13년 전 조회 1,926
13년 전 조회 1,057
13년 전 조회 1,082
13년 전 조회 820
13년 전 조회 1,000
13년 전 조회 1,994
13년 전 조회 497
13년 전 조회 862
13년 전 조회 2,161
13년 전 조회 979
13년 전 조회 544
13년 전 조회 989
13년 전 조회 823
13년 전 조회 882
13년 전 조회 1,145
13년 전 조회 1,940
13년 전 조회 1,059
13년 전 조회 1,420
13년 전 조회 517
13년 전 조회 579
13년 전 조회 505
13년 전 조회 454
13년 전 조회 751
13년 전 조회 796
13년 전 조회 477
13년 전 조회 732
13년 전 조회 1,317
13년 전 조회 543
13년 전 조회 1,355
13년 전 조회 422
13년 전 조회 661
13년 전 조회 439
13년 전 조회 676
13년 전 조회 522
13년 전 조회 865
13년 전 조회 913
13년 전 조회 800
13년 전 조회 2,649
13년 전 조회 423
13년 전 조회 685
13년 전 조회 592
13년 전 조회 1,078
13년 전 조회 814
13년 전 조회 1,457
13년 전 조회 1,803
13년 전 조회 1,147
13년 전 조회 3,017
13년 전 조회 1,293
13년 전 조회 674
13년 전 조회 2,096
13년 전 조회 2,540
13년 전 조회 400
13년 전 조회 532
13년 전 조회 435
13년 전 조회 533
13년 전 조회 471
13년 전 조회 669
13년 전 조회 1,919
13년 전 조회 396
13년 전 조회 392
13년 전 조회 539
13년 전 조회 503
13년 전 조회 398
13년 전 조회 709
13년 전 조회 645
13년 전 조회 407
13년 전 조회 422
13년 전 조회 1,389
13년 전 조회 658
13년 전 조회 1,043
13년 전 조회 415
13년 전 조회 1,019
13년 전 조회 548
13년 전 조회 409
13년 전 조회 670
13년 전 조회 2,182
13년 전 조회 853
13년 전 조회 1,526
13년 전 조회 435
13년 전 조회 466
13년 전 조회 720
🐛 버그신고