Last change
on this file since 190 was
189,
checked in by rock, 14 years ago
|
Bugfix:
|
-
Property svn:executable set to
*
|
File size:
773 bytes
|
Line | |
---|
1 | #!/bin/bash |
---|
2 | # Program: |
---|
3 | # Delete duplicating VM MAC |
---|
4 | # Author: |
---|
5 | # Rock {waue, shunfa, rock}@nchc.org.tw |
---|
6 | # Version: |
---|
7 | # 1.0 |
---|
8 | # History: |
---|
9 | # 2010/08/26 Rock First release (1.0) |
---|
10 | |
---|
11 | # 刪掉空白行 |
---|
12 | #sed -i '/^$/d' "$1" |
---|
13 | |
---|
14 | #read -p "cp - f $1 ${1}.old ; $?" |
---|
15 | cp $1 $1.$(date +%Y-%m-%d-%H-%M-%S).drbl-virt_bak |
---|
16 | |
---|
17 | read -p "debug $VM_MACs" |
---|
18 | # Delete duplating VM MAC |
---|
19 | for vm_mac in $(echo $VM_MACs) |
---|
20 | do |
---|
21 | vm_mac_lines=$(cat -n $1 | grep $vm_mac | awk '{print $1}' ) |
---|
22 | # no duplicated vlaue, doesn't do it |
---|
23 | if [ -n $vm_mac_lines ]; then |
---|
24 | vm_mac_count=$(echo $vm_mac_lines | wc -w) |
---|
25 | |
---|
26 | for (( i=1; i<=${VM_mac_count}; i++ )) |
---|
27 | do |
---|
28 | del_line=$(echo $vm_mac_lines | cut -d " " -f${i}) |
---|
29 | sed -i "${del_line}d" $1 |
---|
30 | done |
---|
31 | fi |
---|
32 | done |
---|
33 | |
---|
34 | |
---|
Note: See
TracBrowser
for help on using the repository browser.