Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: How to run sed.exe in Windows10  (Read 53245 times)

0 Members and 1 Guest are viewing this topic.

davidmcm

    Topic Starter


    Newbie

    • Experience: Familiar
    • OS: Unknown
    How to run sed.exe in Windows10
    « on: December 30, 2021, 03:33:31 PM »
    On BSD, I've been running runsed with sedscr for many years.

    The sedscr would have a line like s/abc/ABC/
    The runsed script I'll paste below. The command would be runsed filename

    I just don't know how to get sed.exe to work. The main problem is setting the permissions in Window10. I try right-clicking the sed icon on my desktop and clicking Run as administrator but still does not work.

    And I am hoping once that is cleared up, a command like this will work at DOS command line: sed s/abc/ABC/ filename
    And beyond that: sed s/abc/ABC/ *.html

    Is there hope?

    for x
    do
    echo "editing $x: \c"
    if test "$x" = sedscr; then
            echo "Not editing sedscript!"
    elif test -s $x; then
            sed -f sedscr $x > /tmp/$x
            if test -s /tmp/$x
            then
            cmp -s $x /tmp/$x && echo "File not changed: \c"; cp /tmp/$x $x;echo "Done."
            else
            echo "Sed produced an empty file -- check sedqscript"
            fi
    else
            echo "original file in empty"
    fi
    done
    echo "all done."


    « Last Edit: December 30, 2021, 07:01:17 PM by nil »

    nil

    • Global Moderator


    • Intermediate
    • Thanked: 15
      • Experience: Experienced
      • OS: Linux variant
      Re: How to run sed.exe in Windows10
      « Reply #1 on: December 30, 2021, 07:04:43 PM »
      On Windows 10 Your best bet is to run WSL which will provide access to bash and GNU sed on your Windows file system

      https://docs.microsoft.com/en-us/windows/wsl/install
      Do not communicate by sharing memory; instead, share memory by communicating.

      --Effective Go