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,175
13년 전 조회 895
13년 전 조회 1,012
13년 전 조회 924
13년 전 조회 779
13년 전 조회 903
13년 전 조회 964
13년 전 조회 1,047
13년 전 조회 1,876
13년 전 조회 569
13년 전 조회 946
13년 전 조회 709
13년 전 조회 516
13년 전 조회 970
13년 전 조회 2,977
13년 전 조회 2,042
13년 전 조회 1,622
13년 전 조회 565
13년 전 조회 1,204
13년 전 조회 2,045
13년 전 조회 1,181
13년 전 조회 1,190
13년 전 조회 936
13년 전 조회 1,121
13년 전 조회 2,112
13년 전 조회 604
13년 전 조회 974
13년 전 조회 2,271
13년 전 조회 1,094
13년 전 조회 657
13년 전 조회 1,107
13년 전 조회 929
13년 전 조회 991
13년 전 조회 1,253
13년 전 조회 2,058
13년 전 조회 1,178
13년 전 조회 1,530
13년 전 조회 639
13년 전 조회 689
13년 전 조회 626
13년 전 조회 574
13년 전 조회 868
13년 전 조회 917
13년 전 조회 599
13년 전 조회 853
13년 전 조회 1,423
13년 전 조회 655
13년 전 조회 1,476
13년 전 조회 534
13년 전 조회 778
13년 전 조회 561
13년 전 조회 781
13년 전 조회 634
13년 전 조회 975
13년 전 조회 1,024
13년 전 조회 915
13년 전 조회 2,762
13년 전 조회 542
13년 전 조회 802
13년 전 조회 704
13년 전 조회 1,175
13년 전 조회 927
13년 전 조회 1,564
13년 전 조회 1,913
13년 전 조회 1,263
13년 전 조회 3,129
13년 전 조회 1,406
13년 전 조회 777
13년 전 조회 2,211
13년 전 조회 2,656
13년 전 조회 509
13년 전 조회 634
13년 전 조회 542
13년 전 조회 650
13년 전 조회 559
13년 전 조회 775
13년 전 조회 2,034
13년 전 조회 514
13년 전 조회 506
13년 전 조회 653
13년 전 조회 610
13년 전 조회 504
13년 전 조회 823
13년 전 조회 756
13년 전 조회 520
13년 전 조회 514
13년 전 조회 1,509
13년 전 조회 756
13년 전 조회 1,153
13년 전 조회 513
13년 전 조회 1,121
13년 전 조회 649
13년 전 조회 513
13년 전 조회 784
13년 전 조회 2,304
13년 전 조회 953
13년 전 조회 1,629
13년 전 조회 544
13년 전 조회 585
13년 전 조회 822
🐛 버그신고