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,075
13년 전 조회 804
13년 전 조회 921
13년 전 조회 837
13년 전 조회 685
13년 전 조회 810
13년 전 조회 885
13년 전 조회 957
13년 전 조회 1,767
13년 전 조회 476
13년 전 조회 854
13년 전 조회 620
13년 전 조회 419
13년 전 조회 873
13년 전 조회 2,888
13년 전 조회 1,950
13년 전 조회 1,525
13년 전 조회 473
13년 전 조회 1,108
13년 전 조회 1,948
13년 전 조회 1,088
13년 전 조회 1,112
13년 전 조회 838
13년 전 조회 1,031
13년 전 조회 2,022
13년 전 조회 516
13년 전 조회 892
13년 전 조회 2,180
13년 전 조회 1,004
13년 전 조회 566
13년 전 조회 1,016
13년 전 조회 838
13년 전 조회 901
13년 전 조회 1,168
13년 전 조회 1,959
13년 전 조회 1,086
13년 전 조회 1,443
13년 전 조회 549
13년 전 조회 601
13년 전 조회 527
13년 전 조회 473
13년 전 조회 769
13년 전 조회 821
13년 전 조회 502
13년 전 조회 760
13년 전 조회 1,335
13년 전 조회 566
13년 전 조회 1,382
13년 전 조회 449
13년 전 조회 687
13년 전 조회 454
13년 전 조회 692
13년 전 조회 551
13년 전 조회 885
13년 전 조회 931
13년 전 조회 824
13년 전 조회 2,669
13년 전 조회 446
13년 전 조회 703
13년 전 조회 610
13년 전 조회 1,091
13년 전 조회 836
13년 전 조회 1,473
13년 전 조회 1,823
13년 전 조회 1,164
13년 전 조회 3,041
13년 전 조회 1,312
13년 전 조회 690
13년 전 조회 2,120
13년 전 조회 2,568
13년 전 조회 421
13년 전 조회 546
13년 전 조회 453
13년 전 조회 553
13년 전 조회 481
13년 전 조회 689
13년 전 조회 1,941
13년 전 조회 413
13년 전 조회 421
13년 전 조회 556
13년 전 조회 520
13년 전 조회 414
13년 전 조회 730
13년 전 조회 667
13년 전 조회 421
13년 전 조회 438
13년 전 조회 1,410
13년 전 조회 671
13년 전 조회 1,062
13년 전 조회 431
13년 전 조회 1,036
13년 전 조회 569
13년 전 조회 427
13년 전 조회 689
13년 전 조회 2,206
13년 전 조회 870
13년 전 조회 1,538
13년 전 조회 461
13년 전 조회 485
13년 전 조회 737
🐛 버그신고