Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 10-13-2002, 10:13 PM   #1
kenny
Confirmed User
 
Industry Role:
Join Date: Mar 2002
Posts: 7,245
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.
__________________
7
kenny is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-13-2002, 10:14 PM   #2
[Labret]
Registered User
 
Industry Role:
Join Date: May 2001
Location: Са́нкт-Петербу́рг
Posts: 10,945
Quote:
Originally posted by kenny
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.
pico file.txt

then

control k (fifty times)

then

control o


You are welcome.
[Labret] is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-13-2002, 10:59 PM   #3
faytl
Confirmed User
 
Join Date: Jul 2002
Location: Australia
Posts: 121
Pico schmico... use vi and go...

vi file.txt
50dd
:wq!

done...
faytl is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-13-2002, 11:07 PM   #4
Odium
Registered User
 
Join Date: Oct 2002
Posts: 9
One can really tell the old-school hackers from the newbies, as good as they may be, few know much of vi!
__________________
A part of the LoveMatch.com network
Odium is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-13-2002, 11:20 PM   #5
american pervert
Confirmed User
 
american pervert's Avatar
 
Join Date: Sep 2002
Location: Los Angeles
Posts: 6,830
as root do

rm *.*

that should fix it
__________________
I can resist everything except temptation
american pervert is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-13-2002, 11:21 PM   #6
L0stMind
Confirmed User
 
Join Date: Sep 2002
Location: Vancity
Posts: 1,681
Quote:
Originally posted by american perv
as root do

rm *.*

that should fix it
Thats just mean.

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.
L0stMind is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-14-2002, 01:29 AM   #7
ReFresh
Confirmed User
 
Join Date: Jul 2002
Location: In a house now. Under an overpass if I don't start making money.
Posts: 123
Quote:
Originally posted by american perv
as root do

rm *.*

that should fix it
Making a mental note now "Never ask how-to questions on GFY..."
__________________
"If it floats, flies or fucks... rent it"
<a href="http://www.goodpussygonebad.com" target="_blank">
<img border="0" src="http://www.goodpussygonebad.com/images/site/GPGBLogo_sm.jpg" width="73" height="74">
ReFresh is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-14-2002, 04:25 AM   #8
kenny
Confirmed User
 
Industry Role:
Join Date: Mar 2002
Posts: 7,245
Quote:
Originally posted by american perv
as root do

rm *.*

that should fix it


Fuck You
__________________
7
kenny is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-14-2002, 04:39 AM   #9
swedguy
Confirmed User
 
Industry Role:
Join Date: Jan 2002
Posts: 7,981
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)
swedguy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-14-2002, 08:14 AM   #10
fnet
Confirmed User
 
Join Date: Jul 2002
Posts: 1,721
Quote:
Originally posted by american perv
as root do

rm *.*

that should fix it
Winders user, eh?

This would only kill files local to the current directory that contain a "."
__________________
the sound of one hand googlewhacking
fnet is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-14-2002, 08:45 AM   #11
X37375787
Guest
 
Posts: n/a
Quote:
Originally posted by fnet


Winders user, eh?

This would only kill files local to the current directory that contain a "."

rm -f / perhaps ?
  Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-14-2002, 11:33 AM   #12
buran
Confirmed User
 
Join Date: Mar 2002
Location: how'd I get here?
Posts: 264
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:~#
__________________
[this signature intentionally left blank]
buran is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-14-2002, 09:53 PM   #13
kenny
Confirmed User
 
Industry Role:
Join Date: Mar 2002
Posts: 7,245
Quote:
Originally posted by swedguy
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)

I learned a few advanced commands from you, you must be lethal with a shell
__________________
7
kenny is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.