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,030
13년 전 조회 758
13년 전 조회 876
13년 전 조회 785
13년 전 조회 648
13년 전 조회 763
13년 전 조회 838
13년 전 조회 908
13년 전 조회 1,721
13년 전 조회 431
13년 전 조회 805
13년 전 조회 579
13년 전 조회 382
13년 전 조회 838
13년 전 조회 2,850
13년 전 조회 1,916
13년 전 조회 1,478
13년 전 조회 441
13년 전 조회 1,066
13년 전 조회 1,907
13년 전 조회 1,041
13년 전 조회 1,066
13년 전 조회 804
13년 전 조회 980
13년 전 조회 1,980
13년 전 조회 483
13년 전 조회 842
13년 전 조회 2,142
13년 전 조회 959
13년 전 조회 523
13년 전 조회 967
13년 전 조회 809
13년 전 조회 865
13년 전 조회 1,128
13년 전 조회 1,917
13년 전 조회 1,042
13년 전 조회 1,399
13년 전 조회 497
13년 전 조회 558
13년 전 조회 485
13년 전 조회 433
13년 전 조회 732
13년 전 조회 775
13년 전 조회 456
13년 전 조회 712
13년 전 조회 1,299
13년 전 조회 525
13년 전 조회 1,331
13년 전 조회 402
13년 전 조회 646
13년 전 조회 417
13년 전 조회 656
13년 전 조회 504
13년 전 조회 847
13년 전 조회 899
13년 전 조회 782
13년 전 조회 2,627
13년 전 조회 404
13년 전 조회 666
13년 전 조회 573
13년 전 조회 1,068
13년 전 조회 796
13년 전 조회 1,438
13년 전 조회 1,783
13년 전 조회 1,125
13년 전 조회 2,998
13년 전 조회 1,279
13년 전 조회 660
13년 전 조회 2,078
13년 전 조회 2,519
13년 전 조회 380
13년 전 조회 516
13년 전 조회 412
13년 전 조회 513
13년 전 조회 454
13년 전 조회 650
13년 전 조회 1,899
13년 전 조회 374
13년 전 조회 373
13년 전 조회 517
13년 전 조회 483
13년 전 조회 376
13년 전 조회 691
13년 전 조회 633
13년 전 조회 387
13년 전 조회 402
13년 전 조회 1,368
13년 전 조회 644
13년 전 조회 1,027
13년 전 조회 403
13년 전 조회 1,001
13년 전 조회 527
13년 전 조회 390
13년 전 조회 657
13년 전 조회 2,163
13년 전 조회 836
13년 전 조회 1,511
13년 전 조회 420
13년 전 조회 448
13년 전 조회 700
🐛 버그신고