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년 전 조회 760
13년 전 조회 880
13년 전 조회 789
13년 전 조회 650
13년 전 조회 767
13년 전 조회 842
13년 전 조회 911
13년 전 조회 1,724
13년 전 조회 435
13년 전 조회 806
13년 전 조회 581
13년 전 조회 383
13년 전 조회 842
13년 전 조회 2,854
13년 전 조회 1,919
13년 전 조회 1,481
13년 전 조회 443
13년 전 조회 1,068
13년 전 조회 1,910
13년 전 조회 1,043
13년 전 조회 1,067
13년 전 조회 807
13년 전 조회 983
13년 전 조회 1,982
13년 전 조회 483
13년 전 조회 847
13년 전 조회 2,144
13년 전 조회 962
13년 전 조회 527
13년 전 조회 969
13년 전 조회 812
13년 전 조회 866
13년 전 조회 1,131
13년 전 조회 1,919
13년 전 조회 1,044
13년 전 조회 1,402
13년 전 조회 499
13년 전 조회 561
13년 전 조회 488
13년 전 조회 436
13년 전 조회 734
13년 전 조회 778
13년 전 조회 463
13년 전 조회 716
13년 전 조회 1,303
13년 전 조회 530
13년 전 조회 1,335
13년 전 조회 406
13년 전 조회 650
13년 전 조회 421
13년 전 조회 659
13년 전 조회 506
13년 전 조회 852
13년 전 조회 902
13년 전 조회 787
13년 전 조회 2,631
13년 전 조회 410
13년 전 조회 672
13년 전 조회 578
13년 전 조회 1,071
13년 전 조회 802
13년 전 조회 1,442
13년 전 조회 1,788
13년 전 조회 1,127
13년 전 조회 3,001
13년 전 조회 1,282
13년 전 조회 663
13년 전 조회 2,081
13년 전 조회 2,522
13년 전 조회 385
13년 전 조회 520
13년 전 조회 416
13년 전 조회 516
13년 전 조회 459
13년 전 조회 655
13년 전 조회 1,903
13년 전 조회 377
13년 전 조회 379
13년 전 조회 523
13년 전 조회 488
13년 전 조회 381
13년 전 조회 695
13년 전 조회 635
13년 전 조회 391
13년 전 조회 405
13년 전 조회 1,373
13년 전 조회 648
13년 전 조회 1,031
13년 전 조회 406
13년 전 조회 1,005
13년 전 조회 533
13년 전 조회 394
13년 전 조회 661
13년 전 조회 2,167
13년 전 조회 841
13년 전 조회 1,512
13년 전 조회 424
13년 전 조회 452
13년 전 조회 703
🐛 버그신고