I have several files in one folder, and I want to delete the first lines in all of them. If I do this:
sed -i.bak '1,2000d' *.dat
the first 2000 lines are deleted, but then the filename is still of the form *.dat
and the next 2000 lines are deleted as well, and so on until the file is empty. How can I fix this? Preferably without a complicated script? There are too many files to just list all the file names, they are too complicated to type them all.
*.dat
is dealt with. It is expanded only once, before the command is run so there's no way it can cause an infinite loop.