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년 전 조회 778
13년 전 조회 896
13년 전 조회 805
13년 전 조회 665
13년 전 조회 781
13년 전 조회 860
13년 전 조회 925
13년 전 조회 1,741
13년 전 조회 448
13년 전 조회 823
13년 전 조회 595
13년 전 조회 401
13년 전 조회 852
13년 전 조회 2,867
13년 전 조회 1,930
13년 전 조회 1,493
13년 전 조회 455
13년 전 조회 1,084
13년 전 조회 1,923
13년 전 조회 1,057
13년 전 조회 1,081
13년 전 조회 820
13년 전 조회 998
13년 전 조회 1,994
13년 전 조회 494
13년 전 조회 862
13년 전 조회 2,159
13년 전 조회 978
13년 전 조회 542
13년 전 조회 989
13년 전 조회 823
13년 전 조회 882
13년 전 조회 1,144
13년 전 조회 1,939
13년 전 조회 1,057
13년 전 조회 1,419
13년 전 조회 517
13년 전 조회 579
13년 전 조회 505
13년 전 조회 453
13년 전 조회 747
13년 전 조회 796
13년 전 조회 476
13년 전 조회 728
13년 전 조회 1,317
13년 전 조회 542
13년 전 조회 1,353
13년 전 조회 421
13년 전 조회 660
13년 전 조회 439
13년 전 조회 676
13년 전 조회 522
13년 전 조회 864
13년 전 조회 911
13년 전 조회 800
13년 전 조회 2,647
13년 전 조회 423
13년 전 조회 684
13년 전 조회 591
13년 전 조회 1,078
13년 전 조회 813
13년 전 조회 1,457
13년 전 조회 1,803
13년 전 조회 1,144
13년 전 조회 3,014
13년 전 조회 1,292
13년 전 조회 674
13년 전 조회 2,096
13년 전 조회 2,539
13년 전 조회 397
13년 전 조회 532
13년 전 조회 432
13년 전 조회 532
13년 전 조회 470
13년 전 조회 668
13년 전 조회 1,916
13년 전 조회 395
13년 전 조회 390
13년 전 조회 539
13년 전 조회 503
13년 전 조회 398
13년 전 조회 709
13년 전 조회 645
13년 전 조회 405
13년 전 조회 421
13년 전 조회 1,388
13년 전 조회 658
13년 전 조회 1,043
13년 전 조회 415
13년 전 조회 1,018
13년 전 조회 544
13년 전 조회 406
13년 전 조회 669
13년 전 조회 2,179
13년 전 조회 853
13년 전 조회 1,526
13년 전 조회 435
13년 전 조회 464
13년 전 조회 719
🐛 버그신고