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,032
13년 전 조회 761
13년 전 조회 880
13년 전 조회 790
13년 전 조회 653
13년 전 조회 768
13년 전 조회 843
13년 전 조회 911
13년 전 조회 1,724
13년 전 조회 435
13년 전 조회 807
13년 전 조회 583
13년 전 조회 384
13년 전 조회 842
13년 전 조회 2,854
13년 전 조회 1,919
13년 전 조회 1,481
13년 전 조회 443
13년 전 조회 1,069
13년 전 조회 1,911
13년 전 조회 1,044
13년 전 조회 1,070
13년 전 조회 807
13년 전 조회 984
13년 전 조회 1,982
13년 전 조회 484
13년 전 조회 848
13년 전 조회 2,144
13년 전 조회 963
13년 전 조회 527
13년 전 조회 970
13년 전 조회 812
13년 전 조회 866
13년 전 조회 1,131
13년 전 조회 1,919
13년 전 조회 1,044
13년 전 조회 1,403
13년 전 조회 499
13년 전 조회 561
13년 전 조회 488
13년 전 조회 439
13년 전 조회 734
13년 전 조회 779
13년 전 조회 464
13년 전 조회 716
13년 전 조회 1,303
13년 전 조회 530
13년 전 조회 1,336
13년 전 조회 406
13년 전 조회 651
13년 전 조회 422
13년 전 조회 660
13년 전 조회 508
13년 전 조회 852
13년 전 조회 903
13년 전 조회 787
13년 전 조회 2,631
13년 전 조회 410
13년 전 조회 672
13년 전 조회 579
13년 전 조회 1,071
13년 전 조회 802
13년 전 조회 1,443
13년 전 조회 1,788
13년 전 조회 1,129
13년 전 조회 3,003
13년 전 조회 1,285
13년 전 조회 664
13년 전 조회 2,081
13년 전 조회 2,524
13년 전 조회 386
13년 전 조회 521
13년 전 조회 417
13년 전 조회 516
13년 전 조회 459
13년 전 조회 656
13년 전 조회 1,904
13년 전 조회 379
13년 전 조회 380
13년 전 조회 523
13년 전 조회 488
13년 전 조회 382
13년 전 조회 697
13년 전 조회 636
13년 전 조회 391
13년 전 조회 405
13년 전 조회 1,374
13년 전 조회 648
13년 전 조회 1,031
13년 전 조회 406
13년 전 조회 1,005
13년 전 조회 533
13년 전 조회 394
13년 전 조회 661
13년 전 조회 2,167
13년 전 조회 841
13년 전 조회 1,514
13년 전 조회 424
13년 전 조회 452
13년 전 조회 704
🐛 버그신고