How do you see a script that can copy the first line of file1.xx and paste it into file2 replacing the entire contents of file2? And in general, is it possible on android? It also interests a separate script that could remove only the first line of the file.

    1 answer 1

    About the android I will not say. But in the shell, the first problem can be solved, for example, like this

    head -n 1 file1.txt > file2.txt 

    Those. using the head command we get the first line and redirect the result to another file.

    The solutions to the second problem depend on whether the number of lines in the file is known or not. Maybe enough tail

    • Found a solution. Copy using your code A and delete with Sed, thanks! - user238026