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,176
13년 전 조회 895
13년 전 조회 1,013
13년 전 조회 924
13년 전 조회 780
13년 전 조회 903
13년 전 조회 964
13년 전 조회 1,049
13년 전 조회 1,876
13년 전 조회 569
13년 전 조회 947
13년 전 조회 709
13년 전 조회 517
13년 전 조회 970
13년 전 조회 2,977
13년 전 조회 2,042
13년 전 조회 1,624
13년 전 조회 565
13년 전 조회 1,204
13년 전 조회 2,045
13년 전 조회 1,182
13년 전 조회 1,191
13년 전 조회 937
13년 전 조회 1,121
13년 전 조회 2,113
13년 전 조회 604
13년 전 조회 974
13년 전 조회 2,272
13년 전 조회 1,094
13년 전 조회 658
13년 전 조회 1,107
13년 전 조회 929
13년 전 조회 992
13년 전 조회 1,253
13년 전 조회 2,058
13년 전 조회 1,179
13년 전 조회 1,531
13년 전 조회 639
13년 전 조회 689
13년 전 조회 627
13년 전 조회 574
13년 전 조회 869
13년 전 조회 918
13년 전 조회 600
13년 전 조회 854
13년 전 조회 1,425
13년 전 조회 655
13년 전 조회 1,476
13년 전 조회 535
13년 전 조회 779
13년 전 조회 561
13년 전 조회 781
13년 전 조회 634
13년 전 조회 975
13년 전 조회 1,024
13년 전 조회 915
13년 전 조회 2,763
13년 전 조회 542
13년 전 조회 803
13년 전 조회 704
13년 전 조회 1,175
13년 전 조회 927
13년 전 조회 1,564
13년 전 조회 1,913
13년 전 조회 1,264
13년 전 조회 3,129
13년 전 조회 1,406
13년 전 조회 778
13년 전 조회 2,211
13년 전 조회 2,656
13년 전 조회 510
13년 전 조회 635
13년 전 조회 543
13년 전 조회 650
13년 전 조회 559
13년 전 조회 775
13년 전 조회 2,034
13년 전 조회 515
13년 전 조회 506
13년 전 조회 653
13년 전 조회 611
13년 전 조회 504
13년 전 조회 823
13년 전 조회 757
13년 전 조회 520
13년 전 조회 515
13년 전 조회 1,511
13년 전 조회 757
13년 전 조회 1,155
13년 전 조회 514
13년 전 조회 1,121
13년 전 조회 649
13년 전 조회 513
13년 전 조회 784
13년 전 조회 2,304
13년 전 조회 954
13년 전 조회 1,630
13년 전 조회 545
13년 전 조회 586
13년 전 조회 822
🐛 버그신고