Link to home
Start Free TrialLog in
Avatar of weklica
weklica

asked on

MAC Script Converted to Windows. XARGS

I have this script which runs well on MAC:  

findscu -S -k 0008,0020=20140101- -k 0008,0052=STUDY -k 0010,0020=102761 -k 0020,000d -aet RadTechServer_H -aec 422DRS507QOP 10.202.16.152 5010 2>&1 | grep StudyInstanceUID | sed 's/.*\[\(.*\)\].*/\1/'  | xargs -I {} movescu -S -k 0008,0052=STUDY -k 0020,000d={} -aet RadTechServer_H -aec 422DRS507QOP 10.202.16.152 5010

The parts that work in windows already without issue are pretty much everything except:
2>&1 | grep
| sed 's/.*\[\(.*\)\].*/\1/'  | xargs -I {}

Those sorts of things.  I downloaded this https://github.com/bmatzelle/gow/wiki and it almost did it, but it started throwing grep: write errors:

So, what can I change to make that windows friendly.  utlimately, I will have thousands of these lines each in a its own batch file and I want to just have them run....
ASKER CERTIFIED SOLUTION
Avatar of serialband
serialband
Flag of Ukraine image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of weklica
weklica

ASKER

I will try that.  I have permissions as admin on that computer, so that shouldn't be the issue, but I will check.  i am sure I will have a few more questions in a bit.

Also, I installed cygwin entirely, but it didn't add it to command line; rather, it was a very linux looking box, so if I use that one I will have to figure out how to launch .bat files from within it.  Thoughts on that?
You can should be able to open a DOS prompt and use the commands if you set your environment path correctly.  If you launch cygwin, then you should just use linux scripts.  It should work just like linux.
Avatar of weklica

ASKER

I couldn't get the DOS prompt to do it, but I can do it from the cygwin prompt which is sufficient.  i will circle back and try to get it working from DOS alone as that would be most excellent for batch files.  Thanks much!
Avatar of weklica

ASKER

Sorry for delay on feedback.  I got it working that day and failed to circle back on this.