-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBasic_Datacleaning.java
More file actions
33 lines (29 loc) · 904 Bytes
/
Copy pathBasic_Datacleaning.java
File metadata and controls
33 lines (29 loc) · 904 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
31
32
33
import java.io.*;
public class Basic_Datacleaning {
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
FileReader fr = new FileReader("C:\\Users\\hp\\Downloads\\[CSE3141] Attendance - Sheet1 (1).csv");
FileWriter fw = new FileWriter("C:\\Users\\hp\\Desktop\\Untitled.txt");
BufferedReader br = new BufferedReader(fr);
BufferedWriter bw = new BufferedWriter(fw);
String line = br.readLine();
while (line != null) {
String ans[] = line.split(",+", 0);
String res = ans[0];
for (int i = 1; i < ans.length - 2; i++) {
res = res + "," + ans[i];
}
System.out.println(res);
bw.write(res + "\n");
line = br.readLine();
}
fr.close();
bw.close();
// System.out.println("File Copied");
} catch (IOException e) {
System.out.println("Error");
e.printStackTrace();
}
}
}