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,062
13년 전 조회 789
13년 전 조회 908
13년 전 조회 817
13년 전 조회 670
13년 전 조회 792
13년 전 조회 871
13년 전 조회 938
13년 전 조회 1,751
13년 전 조회 458
13년 전 조회 832
13년 전 조회 602
13년 전 조회 407
13년 전 조회 860
13년 전 조회 2,871
13년 전 조회 1,937
13년 전 조회 1,503
13년 전 조회 464
13년 전 조회 1,090
13년 전 조회 1,935
13년 전 조회 1,067
13년 전 조회 1,090
13년 전 조회 825
13년 전 조회 1,010
13년 전 조회 2,005
13년 전 조회 507
13년 전 조회 874
13년 전 조회 2,174
13년 전 조회 985
13년 전 조회 556
13년 전 조회 1,000
13년 전 조회 829
13년 전 조회 893
13년 전 조회 1,151
13년 전 조회 1,949
13년 전 조회 1,071
13년 전 조회 1,427
13년 전 조회 527
13년 전 조회 584
13년 전 조회 515
13년 전 조회 462
13년 전 조회 761
13년 전 조회 804
13년 전 조회 487
13년 전 조회 742
13년 전 조회 1,325
13년 전 조회 556
13년 전 조회 1,368
13년 전 조회 432
13년 전 조회 674
13년 전 조회 444
13년 전 조회 684
13년 전 조회 536
13년 전 조회 876
13년 전 조회 921
13년 전 조회 812
13년 전 조회 2,659
13년 전 조회 434
13년 전 조회 693
13년 전 조회 601
13년 전 조회 1,085
13년 전 조회 823
13년 전 조회 1,465
13년 전 조회 1,815
13년 전 조회 1,154
13년 전 조회 3,025
13년 전 조회 1,302
13년 전 조회 683
13년 전 조회 2,106
13년 전 조회 2,552
13년 전 조회 408
13년 전 조회 538
13년 전 조회 440
13년 전 조회 539
13년 전 조회 475
13년 전 조회 680
13년 전 조회 1,929
13년 전 조회 404
13년 전 조회 405
13년 전 조회 550
13년 전 조회 509
13년 전 조회 406
13년 전 조회 720
13년 전 조회 657
13년 전 조회 413
13년 전 조회 431
13년 전 조회 1,400
13년 전 조회 666
13년 전 조회 1,053
13년 전 조회 419
13년 전 조회 1,028
13년 전 조회 558
13년 전 조회 414
13년 전 조회 678
13년 전 조회 2,196
13년 전 조회 856
13년 전 조회 1,530
13년 전 조회 449
13년 전 조회 471
13년 전 조회 728
🐛 버그신고