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,051
13년 전 조회 776
13년 전 조회 896
13년 전 조회 805
13년 전 조회 665
13년 전 조회 781
13년 전 조회 859
13년 전 조회 925
13년 전 조회 1,740
13년 전 조회 448
13년 전 조회 822
13년 전 조회 595
13년 전 조회 400
13년 전 조회 852
13년 전 조회 2,865
13년 전 조회 1,928
13년 전 조회 1,493
13년 전 조회 452
13년 전 조회 1,082
13년 전 조회 1,921
13년 전 조회 1,057
13년 전 조회 1,081
13년 전 조회 819
13년 전 조회 998
13년 전 조회 1,994
13년 전 조회 494
13년 전 조회 861
13년 전 조회 2,158
13년 전 조회 977
13년 전 조회 542
13년 전 조회 987
13년 전 조회 822
13년 전 조회 881
13년 전 조회 1,143
13년 전 조회 1,938
13년 전 조회 1,056
13년 전 조회 1,416
13년 전 조회 517
13년 전 조회 578
13년 전 조회 503
13년 전 조회 453
13년 전 조회 747
13년 전 조회 794
13년 전 조회 475
13년 전 조회 727
13년 전 조회 1,316
13년 전 조회 541
13년 전 조회 1,350
13년 전 조회 419
13년 전 조회 659
13년 전 조회 437
13년 전 조회 676
13년 전 조회 522
13년 전 조회 861
13년 전 조회 910
13년 전 조회 800
13년 전 조회 2,645
13년 전 조회 422
13년 전 조회 683
13년 전 조회 590
13년 전 조회 1,077
13년 전 조회 810
13년 전 조회 1,454
13년 전 조회 1,801
13년 전 조회 1,143
13년 전 조회 3,013
13년 전 조회 1,292
13년 전 조회 672
13년 전 조회 2,095
13년 전 조회 2,538
13년 전 조회 397
13년 전 조회 531
13년 전 조회 432
13년 전 조회 529
13년 전 조회 470
13년 전 조회 667
13년 전 조회 1,916
13년 전 조회 393
13년 전 조회 389
13년 전 조회 537
13년 전 조회 503
13년 전 조회 394
13년 전 조회 708
13년 전 조회 644
13년 전 조회 404
13년 전 조회 419
13년 전 조회 1,387
13년 전 조회 657
13년 전 조회 1,043
13년 전 조회 415
13년 전 조회 1,016
13년 전 조회 543
13년 전 조회 405
13년 전 조회 669
13년 전 조회 2,178
13년 전 조회 851
13년 전 조회 1,526
13년 전 조회 435
13년 전 조회 464
13년 전 조회 716
🐛 버그신고