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,091
13년 전 조회 820
13년 전 조회 941
13년 전 조회 857
13년 전 조회 704
13년 전 조회 830
13년 전 조회 901
13년 전 조회 984
13년 전 조회 1,788
13년 전 조회 492
13년 전 조회 872
13년 전 조회 631
13년 전 조회 437
13년 전 조회 888
13년 전 조회 2,901
13년 전 조회 1,970
13년 전 조회 1,543
13년 전 조회 496
13년 전 조회 1,125
13년 전 조회 1,965
13년 전 조회 1,105
13년 전 조회 1,124
13년 전 조회 855
13년 전 조회 1,046
13년 전 조회 2,034
13년 전 조회 531
13년 전 조회 903
13년 전 조회 2,193
13년 전 조회 1,018
13년 전 조회 580
13년 전 조회 1,027
13년 전 조회 853
13년 전 조회 918
13년 전 조회 1,184
13년 전 조회 1,977
13년 전 조회 1,098
13년 전 조회 1,457
13년 전 조회 565
13년 전 조회 615
13년 전 조회 541
13년 전 조회 494
13년 전 조회 783
13년 전 조회 832
13년 전 조회 521
13년 전 조회 777
13년 전 조회 1,357
13년 전 조회 578
13년 전 조회 1,399
13년 전 조회 460
13년 전 조회 704
13년 전 조회 476
13년 전 조회 704
13년 전 조회 566
13년 전 조회 906
13년 전 조회 952
13년 전 조회 839
13년 전 조회 2,684
13년 전 조회 467
13년 전 조회 725
13년 전 조회 635
13년 전 조회 1,104
13년 전 조회 848
13년 전 조회 1,485
13년 전 조회 1,842
13년 전 조회 1,179
13년 전 조회 3,055
13년 전 조회 1,326
13년 전 조회 702
13년 전 조회 2,140
13년 전 조회 2,585
13년 전 조회 438
13년 전 조회 557
13년 전 조회 463
13년 전 조회 566
13년 전 조회 495
13년 전 조회 706
13년 전 조회 1,955
13년 전 조회 434
13년 전 조회 437
13년 전 조회 574
13년 전 조회 534
13년 전 조회 436
13년 전 조회 747
13년 전 조회 688
13년 전 조회 440
13년 전 조회 450
13년 전 조회 1,427
13년 전 조회 681
13년 전 조회 1,077
13년 전 조회 443
13년 전 조회 1,053
13년 전 조회 578
13년 전 조회 441
13년 전 조회 700
13년 전 조회 2,220
13년 전 조회 883
13년 전 조회 1,552
13년 전 조회 475
13년 전 조회 498
13년 전 조회 751
🐛 버그신고