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,053
13년 전 조회 779
13년 전 조회 901
13년 전 조회 810
13년 전 조회 667
13년 전 조회 786
13년 전 조회 860
13년 전 조회 929
13년 전 조회 1,743
13년 전 조회 452
13년 전 조회 824
13년 전 조회 596
13년 전 조회 402
13년 전 조회 854
13년 전 조회 2,868
13년 전 조회 1,931
13년 전 조회 1,497
13년 전 조회 457
13년 전 조회 1,086
13년 전 조회 1,927
13년 전 조회 1,058
13년 전 조회 1,086
13년 전 조회 821
13년 전 조회 1,002
13년 전 조회 1,997
13년 전 조회 498
13년 전 조회 864
13년 전 조회 2,164
13년 전 조회 979
13년 전 조회 544
13년 전 조회 989
13년 전 조회 823
13년 전 조회 884
13년 전 조회 1,146
13년 전 조회 1,940
13년 전 조회 1,060
13년 전 조회 1,420
13년 전 조회 517
13년 전 조회 580
13년 전 조회 506
13년 전 조회 455
13년 전 조회 752
13년 전 조회 797
13년 전 조회 478
13년 전 조회 735
13년 전 조회 1,317
13년 전 조회 545
13년 전 조회 1,355
13년 전 조회 424
13년 전 조회 662
13년 전 조회 441
13년 전 조회 678
13년 전 조회 524
13년 전 조회 865
13년 전 조회 914
13년 전 조회 803
13년 전 조회 2,651
13년 전 조회 426
13년 전 조회 685
13년 전 조회 595
13년 전 조회 1,078
13년 전 조회 815
13년 전 조회 1,457
13년 전 조회 1,804
13년 전 조회 1,148
13년 전 조회 3,018
13년 전 조회 1,294
13년 전 조회 676
13년 전 조회 2,099
13년 전 조회 2,541
13년 전 조회 403
13년 전 조회 532
13년 전 조회 435
13년 전 조회 534
13년 전 조회 471
13년 전 조회 673
13년 전 조회 1,920
13년 전 조회 398
13년 전 조회 396
13년 전 조회 539
13년 전 조회 504
13년 전 조회 400
13년 전 조회 710
13년 전 조회 648
13년 전 조회 408
13년 전 조회 423
13년 전 조회 1,390
13년 전 조회 661
13년 전 조회 1,045
13년 전 조회 416
13년 전 조회 1,020
13년 전 조회 551
13년 전 조회 411
13년 전 조회 674
13년 전 조회 2,184
13년 전 조회 855
13년 전 조회 1,527
13년 전 조회 438
13년 전 조회 468
13년 전 조회 721
🐛 버그신고