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,140
13년 전 조회 860
13년 전 조회 988
13년 전 조회 894
13년 전 조회 749
13년 전 조회 871
13년 전 조회 932
13년 전 조회 1,015
13년 전 조회 1,838
13년 전 조회 538
13년 전 조회 908
13년 전 조회 678
13년 전 조회 479
13년 전 조회 936
13년 전 조회 2,947
13년 전 조회 2,009
13년 전 조회 1,585
13년 전 조회 537
13년 전 조회 1,167
13년 전 조회 2,015
13년 전 조회 1,147
13년 전 조회 1,167
13년 전 조회 911
13년 전 조회 1,088
13년 전 조회 2,081
13년 전 조회 573
13년 전 조회 942
13년 전 조회 2,233
13년 전 조회 1,060
13년 전 조회 618
13년 전 조회 1,066
13년 전 조회 906
13년 전 조회 958
13년 전 조회 1,220
13년 전 조회 2,023
13년 전 조회 1,133
13년 전 조회 1,499
13년 전 조회 604
13년 전 조회 653
13년 전 조회 583
13년 전 조회 542
13년 전 조회 833
13년 전 조회 877
13년 전 조회 571
13년 전 조회 817
13년 전 조회 1,397
13년 전 조회 622
13년 전 조회 1,438
13년 전 조회 500
13년 전 조회 748
13년 전 조회 525
13년 전 조회 745
13년 전 조회 602
13년 전 조회 945
13년 전 조회 987
13년 전 조회 878
13년 전 조회 2,728
13년 전 조회 503
13년 전 조회 769
13년 전 조회 677
13년 전 조회 1,139
13년 전 조회 895
13년 전 조회 1,528
13년 전 조회 1,878
13년 전 조회 1,220
13년 전 조회 3,089
13년 전 조회 1,370
13년 전 조회 743
13년 전 조회 2,189
13년 전 조회 2,626
13년 전 조회 479
13년 전 조회 596
13년 전 조회 508
13년 전 조회 611
13년 전 조회 530
13년 전 조회 744
13년 전 조회 1,992
13년 전 조회 470
13년 전 조회 475
13년 전 조회 615
13년 전 조회 576
13년 전 조회 474
13년 전 조회 789
13년 전 조회 721
13년 전 조회 480
13년 전 조회 489
13년 전 조회 1,472
13년 전 조회 717
13년 전 조회 1,118
13년 전 조회 481
13년 전 조회 1,094
13년 전 조회 619
13년 전 조회 479
13년 전 조회 746
13년 전 조회 2,264
13년 전 조회 919
13년 전 조회 1,592
13년 전 조회 515
13년 전 조회 542
13년 전 조회 792
🐛 버그신고