VideoHelp Forum
+ Reply to Thread
Results 1 to 10 of 10
Thread
  1. Hi

    ()

    I have a file called NVidiaVersion.txt with a blank space on the beginning of the file

    Code:
    
    399.07
    please is there a way to remove it so that it becomes

    Code:
    399.07
    thanks
    Quote Quote  
  2. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    Yes. Open the file in notepad and delete the space. Save
    Quote Quote  
  3. That's a blank line, not a blank space.
    Quote Quote  
  4. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    My guess is that il gatto wants a text editor that can do thorough search & replace, and likely one that can do this repeatedly, as their requests are rarely one-offs. Since all previous conversations were regarding Windows platform, I would suggest Notepad++ for a freeware GUI-based editor, and either Windows own system shell tools CMD or PowerShell as no-cost commandline editors.

    Scott
    Quote Quote  
  5. As usual marcorocchini doesn't specify exactly what he means. Is there only one blank line at the start and one other line -- like in your example? What if there is a space (or several) on the first line -- is that still a "blank" line? Is there always a blank line at the start? Can there be more than one blank line at the start -- and do they all need to be removed? Are there other blank lines in the file that need to be retained? Do you need to remove all blank lines?

    Try sed. It can do whatever you need. Read the manual.
    Quote Quote  
  6. yes sorry I mean via commandline batch
    Quote Quote  
  7. Originally Posted by jagabo View Post
    That's a blank line, not a blank space.
    Image
    [Attachment 69602 - Click to enlarge]



    ohh
    Quote Quote  
  8. Member DB83's Avatar
    Join Date
    Jul 2007
    Location
    United Kingdom
    Search Comp PM
    I often think what our 'cat' is smoking.

    A 'blank/empty' line is typically a result of a line-break.


    And what does one gain by removing it ? A few bytes at best.


    Live with it and worry about more important matters.
    Quote Quote  
  9. Originally Posted by DB83 View Post
    And what does one gain by removing it ?
    My guess is he's using a batch file where a program produces a file with the number he needs. Then he wants to import that number into an environment variable. The number is expected on the first line, not the second. For example:

    Code:
    ffprobe.exe -v quiet -show_entries stream=duration -of default=noprint_wrappers=1:nokey=1 -select_streams v:0 %1 >duration.txt
    set /p duration=<duration.txt
    echo duration = %duration%
    pause
    ffprobe is used to get the duration of a video with that duration output to a text file, duration.txt:

    1234
    When the number appears on the first line of the file the environment variable is set correctly (1234 in this case). If there is a leading blank line in the file:


    1234
    setting the environment variables fails.
    Quote Quote  
  10. the brain-limited cat: you have to give yourself a reason. EExactly I don't know if it works but something like:

    Code:
    findstr /v "^$" "%cd%\NVidiaVersion.txt" > "%cd%\NVidiaVersionTemp.txt" & move /y "%cd%\NVidiaVersionTemp.txt" "%cd%\NVidiaVersion2.txt" >nul
    if exist "%cd%\NVidiaVersion.txt" del "%cd%\NVidiaVersion.txt"
    if exist "%cd%\NVidiaVersion2.txt" ren "%cd%\NVidiaVersion2.txt" "NVidiaVersion.txt"
    seems to rewrite the .txt without the blank line
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!