I tested it on my machine and it works, however, i cant fullfil the requirements... Please, could you make the code-review and tell me where the mistake is.
public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String fileName = reader.readLine();
        ArrayList<String> list = new ArrayList<>();
        BufferedReader fileReader = new BufferedReader(new FileReader(fileName));

        if(args.length < 2)
            return;

        String line;
        if(args[0].equals("-u")) {
            while((line = fileReader.readLine()) != null && !line.isEmpty()) {
                if(args[1].equals(line.substring(0, 8).trim())) {
                    String newLine = String.format("%-8s%-30s%-8s%-4s", args[1], args[2], args[3], args[4]);
                    list.add(newLine);
                    continue;
                }
                list.add(line);
            }
        }
        else if(args[0].equals("-d")) {
            while((line = fileReader.readLine()) != null && !line.isEmpty()) {
                if(args[1].equals(line.substring(0, 8).trim()))
                    continue;
                list.add(line);
            }
        }
        fileReader.close();

        PrintStream printStream = new PrintStream(fileName);
        for (int i = 0; i < list.size(); i++) {
            printStream.println(list.get(i));
        }
        printStream.close();
    }