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,048
13년 전 조회 776
13년 전 조회 894
13년 전 조회 801
13년 전 조회 664
13년 전 조회 779
13년 전 조회 856
13년 전 조회 924
13년 전 조회 1,738
13년 전 조회 446
13년 전 조회 820
13년 전 조회 594
13년 전 조회 399
13년 전 조회 852
13년 전 조회 2,864
13년 전 조회 1,927
13년 전 조회 1,491
13년 전 조회 450
13년 전 조회 1,080
13년 전 조회 1,920
13년 전 조회 1,056
13년 전 조회 1,080
13년 전 조회 817
13년 전 조회 996
13년 전 조회 1,992
13년 전 조회 494
13년 전 조회 859
13년 전 조회 2,155
13년 전 조회 976
13년 전 조회 540
13년 전 조회 982
13년 전 조회 818
13년 전 조회 879
13년 전 조회 1,141
13년 전 조회 1,932
13년 전 조회 1,056
13년 전 조회 1,415
13년 전 조회 516
13년 전 조회 575
13년 전 조회 502
13년 전 조회 451
13년 전 조회 745
13년 전 조회 793
13년 전 조회 473
13년 전 조회 727
13년 전 조회 1,313
13년 전 조회 539
13년 전 조회 1,349
13년 전 조회 418
13년 전 조회 658
13년 전 조회 434
13년 전 조회 672
13년 전 조회 519
13년 전 조회 859
13년 전 조회 910
13년 전 조회 800
13년 전 조회 2,644
13년 전 조회 422
13년 전 조회 680
13년 전 조회 588
13년 전 조회 1,077
13년 전 조회 810
13년 전 조회 1,451
13년 전 조회 1,799
13년 전 조회 1,141
13년 전 조회 3,013
13년 전 조회 1,291
13년 전 조회 669
13년 전 조회 2,093
13년 전 조회 2,535
13년 전 조회 396
13년 전 조회 528
13년 전 조회 430
13년 전 조회 528
13년 전 조회 469
13년 전 조회 667
13년 전 조회 1,915
13년 전 조회 391
13년 전 조회 389
13년 전 조회 535
13년 전 조회 502
13년 전 조회 393
13년 전 조회 707
13년 전 조회 644
13년 전 조회 403
13년 전 조회 417
13년 전 조회 1,386
13년 전 조회 656
13년 전 조회 1,039
13년 전 조회 415
13년 전 조회 1,015
13년 전 조회 542
13년 전 조회 403
13년 전 조회 668
13년 전 조회 2,176
13년 전 조회 849
13년 전 조회 1,524
13년 전 조회 432
13년 전 조회 461
13년 전 조회 713
🐛 버그신고