빅

sed xargs 이용해서 파일 이름 일부분 변경하기

· 2012-04-26 (목) 23:38:05 · 2994
 
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
 
 
 
|
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

8,188건
+
제목 글쓴이 날짜 조회
12-06-21 조회 3,956
12-06-21 조회 3,498
12-06-20 조회 3,667
12-06-20 조회 4,251
12-06-20 조회 3,321
12-06-20 조회 4,658
12-06-20 조회 3,313
12-06-20 조회 3,263
12-06-20 조회 4,071
12-06-20 조회 4,296
12-06-18 조회 4,819
12-06-18 조회 3,483
12-06-18 조회 3,613
12-06-18 조회 3,397
12-06-18 조회 4,148
12-06-18 조회 4,794
12-06-17 조회 4,028
12-06-17 조회 3,937
12-06-17 조회 3,573
12-06-16 조회 3,368
12-06-15 조회 3,187
12-06-15 조회 3,896
12-06-15 조회 4,650
12-06-15 조회 4,387
12-06-14 조회 4,018
12-06-14 조회 4,041
12-06-14 조회 3,119
12-06-14 조회 3,516
12-06-14 조회 4,823
12-06-14 조회 3,322
12-06-14 조회 3,168
12-06-13 조회 7,401
12-06-13 조회 3,658
12-06-12 조회 5,621
12-06-11 조회 3,479
12-06-11 조회 3,504
12-06-11 조회 3,496
12-06-11 조회 3,410
12-06-11 조회 3,988
12-06-11 조회 3,282
12-06-08 조회 3,350
12-06-08 조회 4,843
12-06-08 조회 3,164
12-06-08 조회 4,933
12-06-08 조회 3,949
12-06-08 조회 3,485
12-06-08 조회 3,451
12-06-08 조회 4,462
12-06-08 조회 3,083
12-06-08 조회 3,750
12-06-07 조회 4,039
12-06-07 조회 3,942
12-06-06 조회 3,351
12-06-06 조회 3,430
12-06-06 조회 3,724
12-06-06 조회 6,397
12-06-06 조회 5,971
12-06-06 조회 6,723
12-06-05 조회 5,829
12-06-05 조회 3,242
12-06-05 조회 3,313
12-06-05 조회 3,318
12-06-05 조회 1.2만
12-06-05 조회 4,979
12-06-05 조회 5,490
12-06-05 조회 5,264
12-06-05 조회 5,623
12-06-05 조회 3,544
12-06-05 조회 3,501
12-06-05 조회 7,377
12-06-04 조회 3,336
12-06-04 조회 4,192
12-06-04 조회 3,900
12-06-04 조회 3,951
12-06-03 조회 3,802
12-06-02 조회 3,210
12-06-02 조회 3,945
12-06-01 조회 3,356
12-06-01 조회 4,098
12-06-01 조회 3,676
12-06-01 조회 3,320
12-06-01 조회 4,828
12-06-01 조회 3,692
12-06-01 조회 3,292
12-05-31 조회 4,976
12-05-31 조회 3,795
12-05-31 조회 3,724
12-05-31 조회 3,721
12-05-31 조회 3,528
12-05-30 조회 3,175
12-05-30 조회 3,217
12-05-30 조회 4,039
12-05-30 조회 3,298
12-05-29 조회 4,488
12-05-29 조회 3,811
12-05-28 조회 3,195
12-05-28 조회 6,642
12-05-28 조회 3,267
12-05-27 조회 4,614
12-05-27 조회 3,877