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,046
13년 전 조회 775
13년 전 조회 891
13년 전 조회 799
13년 전 조회 661
13년 전 조회 777
13년 전 조회 853
13년 전 조회 923
13년 전 조회 1,737
13년 전 조회 444
13년 전 조회 819
13년 전 조회 594
13년 전 조회 395
13년 전 조회 849
13년 전 조회 2,861
13년 전 조회 1,927
13년 전 조회 1,491
13년 전 조회 449
13년 전 조회 1,078
13년 전 조회 1,919
13년 전 조회 1,056
13년 전 조회 1,079
13년 전 조회 817
13년 전 조회 994
13년 전 조회 1,991
13년 전 조회 493
13년 전 조회 858
13년 전 조회 2,152
13년 전 조회 975
13년 전 조회 538
13년 전 조회 979
13년 전 조회 818
13년 전 조회 877
13년 전 조회 1,139
13년 전 조회 1,930
13년 전 조회 1,054
13년 전 조회 1,414
13년 전 조회 511
13년 전 조회 574
13년 전 조회 499
13년 전 조회 450
13년 전 조회 744
13년 전 조회 792
13년 전 조회 471
13년 전 조회 726
13년 전 조회 1,312
13년 전 조회 536
13년 전 조회 1,348
13년 전 조회 417
13년 전 조회 656
13년 전 조회 433
13년 전 조회 672
13년 전 조회 519
13년 전 조회 859
13년 전 조회 909
13년 전 조회 798
13년 전 조회 2,642
13년 전 조회 418
13년 전 조회 679
13년 전 조회 586
13년 전 조회 1,077
13년 전 조회 809
13년 전 조회 1,449
13년 전 조회 1,798
13년 전 조회 1,141
13년 전 조회 3,012
13년 전 조회 1,291
13년 전 조회 669
13년 전 조회 2,093
13년 전 조회 2,535
13년 전 조회 395
13년 전 조회 526
13년 전 조회 428
13년 전 조회 525
13년 전 조회 467
13년 전 조회 664
13년 전 조회 1,914
13년 전 조회 389
13년 전 조회 386
13년 전 조회 533
13년 전 조회 501
13년 전 조회 393
13년 전 조회 703
13년 전 조회 644
13년 전 조회 403
13년 전 조회 417
13년 전 조회 1,384
13년 전 조회 653
13년 전 조회 1,038
13년 전 조회 413
13년 전 조회 1,014
13년 전 조회 541
13년 전 조회 401
13년 전 조회 667
13년 전 조회 2,176
13년 전 조회 847
13년 전 조회 1,522
13년 전 조회 431
13년 전 조회 459
13년 전 조회 712
🐛 버그신고