9

I have an excel sheet (1 of 2) and it has 54515 product codes inside.

I copy all of them to sublime, select all of the extra spaces at the end of each one and delete them.

18 min later it's done. 637240 spaces.

Comments
  • 1
    You sir need a hobby
  • 3
    @MisterArie I didn't do it by hand 😂.
    It took sublime 18 min to delete all of the spaces. I selected all of them with cmd+ctrl+g
  • 1
  • 3
    Script that using bash, it'll take 18 seconds
  • 1
    @matanl
    Yeah. Sublime needs to buffer all the changes before it commits them to file and in huge files, that requires a lot of memory, which makes it slow.

    He could use `sed` to do it a whole lot faster.
  • 3
    @paulwillyjean This is not true, buffering to memory is much faster than reading it from the hard drive (or even SSD). What takes time in sublime is internal data structures it keeps to provide fast searching. These structures explode when the file is too large, and have to be constantly updated on each replace.
  • 1
    Use a real editor like Vim or Emacs and it should've taken you like 8 seconds.
  • 0
    @matanl

    You're right. I should have been more explicit when I wrote buffer the changes. I obviously didn't just meet the file, but whichever way they use to track those changes.
  • 1
    @rayanon

    Had one come in today with 57k products and multiple spaces at the end of each line.

    Remembered your comment and at first I pasted them into a blank vim file but it slowly pastes line by line. So I just pasted them into a txt file and saved it then opened that file in vim.

    Selected all space and deleted them instantly. So hats off to you for that suggestion. Thank you!
  • 0
    @theflyingbyrd while pasting you noticed it's pasting line by line because probably there is an auto indent/smart indent settings in the vimrc, which makes vim attempt to indent the line being pasted. Simple workaround: switch to paste mode (:set paste), and then paste it like in a text file and it should be instant. :)
  • 1
    @rayanon @theflyingbyrd switch off paste mode by :set nopaste
  • 1
    @rayanon I did set paste and it still did it. Maybe because I entered insert mode instead of doing it from normal mode?
  • 0
    @rayanon ahh I set paste on. I'll try it without just to experiment
  • 0
    @theflyingbyrd ah! Should have worked with paste on though. Not sure why it didn't.
Add Comment