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년 전 조회 759
13년 전 조회 879
13년 전 조회 788
13년 전 조회 650
13년 전 조회 765
13년 전 조회 840
13년 전 조회 910
13년 전 조회 1,722
13년 전 조회 433
13년 전 조회 806
13년 전 조회 580
13년 전 조회 383
13년 전 조회 842
13년 전 조회 2,854
13년 전 조회 1,919
13년 전 조회 1,480
13년 전 조회 442
13년 전 조회 1,068
13년 전 조회 1,909
13년 전 조회 1,043
13년 전 조회 1,067
13년 전 조회 807
13년 전 조회 983
13년 전 조회 1,982
13년 전 조회 483
13년 전 조회 846
13년 전 조회 2,142
13년 전 조회 961
13년 전 조회 524
13년 전 조회 968
13년 전 조회 810
13년 전 조회 866
13년 전 조회 1,130
13년 전 조회 1,917
13년 전 조회 1,043
13년 전 조회 1,400
13년 전 조회 498
13년 전 조회 559
13년 전 조회 486
13년 전 조회 434
13년 전 조회 733
13년 전 조회 777
13년 전 조회 459
13년 전 조회 714
13년 전 조회 1,300
13년 전 조회 527
13년 전 조회 1,333
13년 전 조회 404
13년 전 조회 649
13년 전 조회 420
13년 전 조회 658
13년 전 조회 504
13년 전 조회 850
13년 전 조회 900
13년 전 조회 784
13년 전 조회 2,628
13년 전 조회 407
13년 전 조회 669
13년 전 조회 574
13년 전 조회 1,069
13년 전 조회 797
13년 전 조회 1,439
13년 전 조회 1,784
13년 전 조회 1,126
13년 전 조회 2,999
13년 전 조회 1,280
13년 전 조회 661
13년 전 조회 2,079
13년 전 조회 2,520
13년 전 조회 382
13년 전 조회 517
13년 전 조회 414
13년 전 조회 515
13년 전 조회 457
13년 전 조회 653
13년 전 조회 1,901
13년 전 조회 375
13년 전 조회 376
13년 전 조회 520
13년 전 조회 485
13년 전 조회 378
13년 전 조회 692
13년 전 조회 634
13년 전 조회 389
13년 전 조회 404
13년 전 조회 1,370
13년 전 조회 644
13년 전 조회 1,028
13년 전 조회 404
13년 전 조회 1,003
13년 전 조회 529
13년 전 조회 391
13년 전 조회 659
13년 전 조회 2,165
13년 전 조회 838
13년 전 조회 1,511
13년 전 조회 421
13년 전 조회 449
13년 전 조회 701
🐛 버그신고