![]() |
unix commands
Is there a command that will delete the first 50 lines in a file? I know I can display the first 50 lines with "head -50 somefile.txt", but I need to delete the first 50 lines. :helpme
|
Quote:
then control k (fifty times) then control o You are welcome. |
Pico schmico... use vi and go...
vi file.txt 50dd :wq! done... |
One can really tell the old-school hackers from the newbies, as good as they may be, few know much of vi!
|
as root do
rm *.* that should fix it |
Quote:
do what the vi guy said. labrets method will work fine, but in some cases pico can do some funky shit to your files... truncating lines and shit. I don't use it anymore. |
Quote:
:Graucho |
Quote:
Fuck You |
faytl's way is good.
But if you don't wanna mess around in vi, here's another way: tail +51 somefile.txt > somefile.txt.tmp; mv somefile.txt.tmp somefile.txt tail +51 = it will print the 51'st line to the last line > somefile.txt.tmp = redirect the output to a temp file mv somefile.txt.tmp somefile.txt = move the temp file over the original file (you can skip that part if it's not necessary) |
Quote:
This would only kill files local to the current directory that contain a "." |
Quote:
rm -f / perhaps ? |
rm -rf /
f means don't confirm r means recurisve you have to be root if you really want to fuck shit up. Of course, no one should run this command unless they want to hose the machine. To all the vi'ers out there, amen brother. once you go vi, you don't go back. and the tail -51+ method works just as well. root@yourbox:~# |
Quote:
I learned a few advanced commands from you, you must be lethal with a shell:winkwink: |
All times are GMT -7. The time now is 09:48 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123