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,060
13년 전 조회 784
13년 전 조회 903
13년 전 조회 813
13년 전 조회 668
13년 전 조회 789
13년 전 조회 867
13년 전 조회 933
13년 전 조회 1,749
13년 전 조회 456
13년 전 조회 830
13년 전 조회 600
13년 전 조회 405
13년 전 조회 856
13년 전 조회 2,869
13년 전 조회 1,934
13년 전 조회 1,499
13년 전 조회 461
13년 전 조회 1,089
13년 전 조회 1,931
13년 전 조회 1,064
13년 전 조회 1,088
13년 전 조회 823
13년 전 조회 1,005
13년 전 조회 2,004
13년 전 조회 500
13년 전 조회 872
13년 전 조회 2,169
13년 전 조회 982
13년 전 조회 552
13년 전 조회 995
13년 전 조회 826
13년 전 조회 887
13년 전 조회 1,149
13년 전 조회 1,944
13년 전 조회 1,065
13년 전 조회 1,423
13년 전 조회 523
13년 전 조회 582
13년 전 조회 506
13년 전 조회 458
13년 전 조회 755
13년 전 조회 801
13년 전 조회 482
13년 전 조회 738
13년 전 조회 1,320
13년 전 조회 552
13년 전 조회 1,360
13년 전 조회 429
13년 전 조회 669
13년 전 조회 443
13년 전 조회 681
13년 전 조회 532
13년 전 조회 870
13년 전 조회 917
13년 전 조회 807
13년 전 조회 2,656
13년 전 조회 430
13년 전 조회 690
13년 전 조회 599
13년 전 조회 1,082
13년 전 조회 819
13년 전 조회 1,462
13년 전 조회 1,810
13년 전 조회 1,153
13년 전 조회 3,022
13년 전 조회 1,300
13년 전 조회 679
13년 전 조회 2,104
13년 전 조회 2,548
13년 전 조회 406
13년 전 조회 536
13년 전 조회 437
13년 전 조회 537
13년 전 조회 474
13년 전 조회 676
13년 전 조회 1,924
13년 전 조회 401
13년 전 조회 398
13년 전 조회 546
13년 전 조회 505
13년 전 조회 402
13년 전 조회 716
13년 전 조회 652
13년 전 조회 409
13년 전 조회 427
13년 전 조회 1,396
13년 전 조회 663
13년 전 조회 1,049
13년 전 조회 416
13년 전 조회 1,025
13년 전 조회 554
13년 전 조회 412
13년 전 조회 677
13년 전 조회 2,190
13년 전 조회 856
13년 전 조회 1,528
13년 전 조회 447
13년 전 조회 469
13년 전 조회 724
🐛 버그신고