23

What would be the Windows 7 Equivalent for the following command?

find . -type f -print0 | xargs -0 sed -i 's/ url \([^" >][^ >]*\)/ url "\1"/g'

I am trying to migrate Django 1.4 to 1.5

5 Answers 5

14

I think that installing original tools is much better in terms of unification then rewriting everything. I personally use GOW, it still misses a tiny number of commands but contains all most needed stuff.

If you still want to hit batch programming there's a good list of all commands: http://ss64.com/nt/, I think you need forfiles.

3
  • 4
    The identical xargs.exe can be found in the package findutils from the project GnuWin ( gnuwin32.sourceforge.net/packages/findutils.htm )
    – tehnicaorg
    Commented Jan 7, 2020 at 13:20
  • how to access/run xargs after installing GOW? I'm trying to run a command on a project folder and seems it's still missing Commented Apr 12, 2021 at 20:11
  • GoW adds to the Path environment variable so it should be accessible from any cmd/powershell you open after its installed. If you opened a cmd window before installation that might explain what you're seeing
    – Chris Rudd
    Commented Mar 4, 2022 at 17:35
1

Copied from here

@echo off
:: example:   git branch | grep -v "develop" | xargs git branch -D
:: example    xargs -a input.txt echo
:: https://helloacm.com/simple-xargs-batch-implementation-for-windows/
setlocal enabledelayedexpansion

set args=
set file='more'

:: read from file
if "%1" == "-a" (
    if "%2" == "" (
        echo Correct Usage: %0 -a Input.txt command
        goto end
    )
    set file=%2
    shift
    shift
    goto start
)

:: read from stdin
set args=%1
shift

:start
    if [%1] == [] goto start1
    set args=%args% %1
    shift
    goto start

:start1
    for /F "tokens=*" %%a in (!file!) do (
        %args% %%a
    )

:end
1

In my experience only rush works correctly on Windows - it handles paths with backslashes and allows \r\n as a delimiter. Has native (non cygwin) build, can buffer and sort output.

0

Minimalist xargs for Windows created using pyinstaller and a short python script is available below:

https://github.com/manasmbellani/xargswin/releases

0

TextTools (github.com) includes a Windows-native xargs clone called wargs. It supports nearly all of the GNU xargs functionality, plus options to specify the input text's encoding in case it isn't ASCII.

1
  • 1
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented May 24, 2022 at 18:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .