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,122
13년 전 조회 845
13년 전 조회 975
13년 전 조회 886
13년 전 조회 739
13년 전 조회 859
13년 전 조회 916
13년 전 조회 1,000
13년 전 조회 1,821
13년 전 조회 521
13년 전 조회 893
13년 전 조회 666
13년 전 조회 469
13년 전 조회 923
13년 전 조회 2,936
13년 전 조회 1,998
13년 전 조회 1,568
13년 전 조회 521
13년 전 조회 1,154
13년 전 조회 1,997
13년 전 조회 1,137
13년 전 조회 1,157
13년 전 조회 892
13년 전 조회 1,076
13년 전 조회 2,065
13년 전 조회 560
13년 전 조회 930
13년 전 조회 2,219
13년 전 조회 1,040
13년 전 조회 607
13년 전 조회 1,053
13년 전 조회 886
13년 전 조회 946
13년 전 조회 1,208
13년 전 조회 2,006
13년 전 조회 1,123
13년 전 조회 1,485
13년 전 조회 595
13년 전 조회 642
13년 전 조회 570
13년 전 조회 532
13년 전 조회 816
13년 전 조회 860
13년 전 조회 557
13년 전 조회 807
13년 전 조회 1,378
13년 전 조회 601
13년 전 조회 1,428
13년 전 조회 491
13년 전 조회 736
13년 전 조회 513
13년 전 조회 725
13년 전 조회 590
13년 전 조회 931
13년 전 조회 973
13년 전 조회 867
13년 전 조회 2,715
13년 전 조회 489
13년 전 조회 751
13년 전 조회 663
13년 전 조회 1,130
13년 전 조회 876
13년 전 조회 1,513
13년 전 조회 1,860
13년 전 조회 1,209
13년 전 조회 3,078
13년 전 조회 1,358
13년 전 조회 727
13년 전 조회 2,169
13년 전 조회 2,614
13년 전 조회 466
13년 전 조회 586
13년 전 조회 496
13년 전 조회 596
13년 전 조회 520
13년 전 조회 731
13년 전 조회 1,984
13년 전 조회 457
13년 전 조회 457
13년 전 조회 600
13년 전 조회 565
13년 전 조회 458
13년 전 조회 774
13년 전 조회 710
13년 전 조회 469
13년 전 조회 478
13년 전 조회 1,463
13년 전 조회 699
13년 전 조회 1,105
13년 전 조회 471
13년 전 조회 1,087
13년 전 조회 604
13년 전 조회 467
13년 전 조회 733
13년 전 조회 2,248
13년 전 조회 908
13년 전 조회 1,583
13년 전 조회 500
13년 전 조회 522
13년 전 조회 782
🐛 버그신고