Skip to content

Instantly share code, notes, and snippets.

@taka2
Created March 12, 2022 07:03
Show Gist options
  • Save taka2/40b8e09e37f8d8c917df5e8966deed32 to your computer and use it in GitHub Desktop.
Save taka2/40b8e09e37f8d8c917df5e8966deed32 to your computer and use it in GitHub Desktop.
import java.io.File;
import java.util.List;
import java.util.Arrays;
import java.nio.file.*;
// 引数で渡されたCSVファイルから先頭2列を削除して標準出力に表示する。データ内のカンマについては考慮されていない。
public class test {
public static void main(String[] args) throws Exception {
List<String> allLines = Files.readAllLines(new File(args[0]).toPath());
for(String line : allLines) {
String[] splittedLine = line.split(",");
System.out.println(String.join(",", Arrays.copyOfRange(splittedLine, 2, splittedLine.length)));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment