-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRegenBlkNum.java
More file actions
30 lines (24 loc) · 805 Bytes
/
RegenBlkNum.java
File metadata and controls
30 lines (24 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// RegenBlkNum.java
// re-generate Block of a GSI file
import java.text.*;
import java.io.*;
import java.util.*;
public class RegenBlkNum {
public static void main(String[] args)throws Exception{
if(args.length !=1){
System.err.println("usage: java RegenBlkNum GSI_file");
System.exit(1);
}
String block_number_style = "0000";
DecimalFormat blockNumberFormatter = new DecimalFormat(block_number_style);
BufferedReader in = in = new BufferedReader(new FileReader(args[0]));
int index=1;
String aLine = null;
while((aLine=in.readLine())!=null){
System.out.print(aLine.substring(0, 2));
System.out.print(blockNumberFormatter.format(index));
System.out.println(aLine.substring(6));
index++;
}
}
}