Results 1 to 7 of 7

Thread: Removing characters from a file..

  1. #1
    Mentor Stuart's Avatar
    Join Date
    May 2002
    Location
    nb.ca
    Posts
    1,087

    Removing characters from a file..

    Okay, so, somehow, this perl script I'm working on gets like 1 million plus signs in it, and gets saved. Don't ask how, I'm not sure. Autosave feature or something. Anyway, the file won't load because of how many there are, so I need some way to get rid of them. Help?

  2. #2
    Mentor Stuart's Avatar
    Join Date
    May 2002
    Location
    nb.ca
    Posts
    1,087

    Re:Removing characters from a file..

    Yea, it's just line 145. About a million, give or take. +++++ times a lot. Gah.
    Okay, fired up nano. I guess there are only just over 100,000 + signs on that line. I'm either gonna be sitting on the delete key all night, or. something. help!

  3. #3
    Mentor Stuart's Avatar
    Join Date
    May 2002
    Location
    nb.ca
    Posts
    1,087

    Re:Removing characters from a file..

    Okay guys, that was close, but sed saved my ass there.
    sed '145d' badfile.pl > goodfile.pl

  4. #4
    Advisor Outlaw's Avatar
    Join Date
    May 2001
    Location
    Clifton Park, NY
    Posts
    630

    Re:Removing characters from a file..

    Ok that's better than

    Code:
    sed 's/+\+//' script >newscript
    But wouldn't going into vim and doing a dd on the line work too?

  5. #5

    Re:Removing characters from a file..

    That's what I was thinking...
    I hate how gentoo makes nano the default $EDITOR...

  6. #6
    Mentor Stuart's Avatar
    Join Date
    May 2002
    Location
    nb.ca
    Posts
    1,087

    Re:Removing characters from a file..

    It would, but I don't have vim installed. I try to run a clean system
    Seriously, vim is just a little too complicated for me to remember how to use. I should learn though.

  7. #7

    Re:Removing characters from a file..

    I don't use VIM, I use elvis.

Similar Threads

  1. Replies: 0
    Last Post: 11-24-2008, 01:38 AM
  2. Russian characters all get messed up
    By AljoshaNL in forum Linux - Software, Applications & Programming
    Replies: 4
    Last Post: 01-14-2006, 08:18 AM
  3. need help removing a file
    By di||itante in forum General Chat
    Replies: 3
    Last Post: 08-04-2004, 09:09 PM
  4. just keep your passwords longer than 8 characters
    By countach44 in forum General Chat
    Replies: 1
    Last Post: 07-04-2004, 09:44 AM
  5. Removing a line from a file
    By tolstoy in forum Linux - Software, Applications & Programming
    Replies: 3
    Last Post: 10-24-2002, 07:41 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •