How to delete certain lines from lots of files in the same directory?
Hello everyone,
I want to delete 2 lines from each file in a certain directory (and all subdirectories). I was wondering if there is a simple command to accomplish this. Thanks for any help, Thom |
what have you tried? hint: use find to find your files. as for deleting lines, there are variety of tools you can use, eg awk, sed , or even the shell.
|
I recommend that you use a shell script with sed,
Give us some more information about what you're trying to accomplish and I'll help you out with the script. Are you trying to delete lines at particular Line numbers? Do these lines have the same text in all files? please be specific. |
sed "$num,+1d" filename
(deletes 2 lines, starting with $num) |
All times are GMT -5. The time now is 02:37 PM. |