빅

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

· 2012-04-26 (목) 23:38:05 · 2984
 
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-04-26 조회 3,838
12-04-24 조회 3,232
12-04-23 조회 4,566
12-04-22 조회 3,258
12-04-19 조회 3,341
12-04-18 조회 4,394
12-04-18 조회 3,105
12-04-17 조회 3,375
12-04-17 조회 5,135
12-04-16 조회 3,558
12-04-13 조회 3,104
12-04-09 조회 3,169
12-04-04 조회 3,940
12-04-01 조회 3,216
12-03-31 조회 3,615
12-03-30 조회 3,222
12-03-30 조회 3,883
12-03-26 조회 3,501
12-03-26 조회 3,076
12-03-22 조회 3,224
12-03-21 조회 3,078
12-03-19 조회 3,488
12-03-17 조회 3,515
12-03-14 조회 3,246
12-03-10 조회 3,928
12-03-09 조회 3,516
12-03-09 조회 3,333
12-03-08 조회 3,809
12-03-08 조회 3,979
12-03-08 조회 4,073
12-03-03 조회 3,327
12-03-02 조회 4,649
12-02-28 조회 3,186
12-02-27 조회 3,002
12-02-25 조회 3,144
12-02-24 조회 3,855
12-02-23 조회 3,119
12-02-22 조회 3,634
12-02-22 조회 5,405
12-02-22 조회 3,978
12-02-22 조회 4,297
12-02-18 조회 3,792
12-02-17 조회 3,011
12-02-17 조회 3,423
12-02-14 조회 3,493
12-02-13 조회 3,370
12-02-10 조회 1만
12-02-08 조회 3,034
12-02-07 조회 3,373
12-02-06 조회 3,095
12-02-05 조회 3,561
12-01-31 조회 3,486
12-01-30 조회 9,672
12-01-29 조회 3,833
12-01-26 조회 3,430
12-01-25 조회 4,043
12-01-24 조회 3,436
12-01-10 조회 3,748
12-01-10 조회 4,505
12-01-09 조회 3,282
12-01-08 조회 7,142
12-01-08 조회 3,666
12-01-07 조회 5,193
12-01-04 조회 3,898
12-01-02 조회 3,124
12-01-02 조회 3,178
12-01-02 조회 3,479
12-01-01 조회 3,117
11-12-31 조회 3,421
11-12-31 조회 3,106
11-12-30 조회 3,270
11-12-30 조회 3,428
11-12-29 조회 3,636
11-12-28 조회 3,722
11-12-26 조회 3,299
11-12-23 조회 3,519
11-12-22 조회 3,061
11-12-15 조회 4,154
11-12-08 조회 3,964
11-12-05 조회 3,306
11-12-04 조회 5,720
11-12-03 조회 3,595
11-12-02 조회 3,368
11-12-01 조회 5,435
11-11-30 조회 2,920
11-11-30 조회 2,825
11-11-28 조회 3,167
11-11-26 조회 3,351
11-11-25 조회 3,368
11-11-24 조회 2,961
11-11-22 조회 3,057
11-11-22 조회 2,898
11-11-17 조회 2,833
11-11-11 조회 2,826
11-11-09 조회 2,880
11-11-08 조회 3,259
11-11-08 조회 2,552
11-11-04 조회 3,633
11-11-01 조회 2,941
11-10-26 조회 2,529