Search found 13 matches

by ferrad
31 Mar 2014 07:45
Forum: DOS Batch Forum
Topic: Help with SED
Replies: 19
Views: 11750

Re: Help with SED

foxidrive wrote:This does it in GnuSED

Code: Select all

sed "s/.*:.[^\]*.\(.*\)\\.*/\1/"


This works great thanks.
by ferrad
31 Mar 2014 07:34
Forum: DOS Batch Forum
Topic: Help with SED
Replies: 19
Views: 11750

Re: Help with SED

Squashman wrote:Is this actually in your listing?
\??\

I don't see any of my junction points coming out like that at all.


Yes that's how it shows in Windows 7
by ferrad
31 Mar 2014 07:28
Forum: DOS Batch Forum
Topic: Help with SED
Replies: 19
Views: 11750

Re: Help with SED

Squashman wrote:

Code: Select all

 dir /AL /B /s


This doesn't show where they are pointing to.
by ferrad
31 Mar 2014 06:48
Forum: DOS Batch Forum
Topic: Help with SED
Replies: 19
Views: 11750

Re: Help with SED

Yes, straight from DIR. I need to determine if a directory is a JUNCTION or not. I don't know how to do this with any other DIR options. If it is, then I need to find out where it is pointing to, eg in the example: d:\ReOTech\Dev\TechRefactoring\BOPVT Then, once I have done that I need to strip ever...
by ferrad
31 Mar 2014 06:22
Forum: DOS Batch Forum
Topic: Help with SED
Replies: 19
Views: 11750

Re: Help with SED

Here is what I need to do. I have: 31/03/2014 12:07 <JUNCTION> BOPVT [\??\d:\ReOTech\Dev\TechRefactoring\BOPVT] I need to strip out everything before the 2nd backslash after d:, and everything after and including the last backslash, ie to get: Dev\TechRefactoring How do you do this in findstr?
by ferrad
31 Mar 2014 06:19
Forum: DOS Batch Forum
Topic: Help with SED
Replies: 19
Views: 11750

Re: Help with SED

I guess I have always used it and know the syntax pretty well. Is findstr similar or not as good?
by ferrad
31 Mar 2014 06:09
Forum: DOS Batch Forum
Topic: Help with SED
Replies: 19
Views: 11750

Re: Help with SED

In case you were wondering:

sed -e "s/.*:\\[^\\]*\\\(\([^\\]*\\\)*\).*/\1/g" -e "s/\(.*\)\\$/\1/g"

works
by ferrad
31 Mar 2014 05:55
Forum: DOS Batch Forum
Topic: Help with SED
Replies: 19
Views: 11750

Help with SED

If anyone knows SED syntax, can they help? I have a bit of text: Dev\TechRefactoring\BOPVT] where there can be any number >=1 occurrences of the \ before \BOPVT. I am trying to remove the last \BOPVT to obtain only: Dev\TechRefactoring It's easy if there is only 1 \, but if the number is variable ho...
by ferrad
28 Mar 2014 04:33
Forum: DOS Batch Forum
Topic: Strange error message
Replies: 7
Views: 4356

Re: Strange error message

Thanks, the end of help set shows this. Also I found the following link:
http://stackoverflow.com/questions/9681 ... s-wont-set
by ferrad
28 Mar 2014 04:11
Forum: DOS Batch Forum
Topic: Strange error message
Replies: 7
Views: 4356

Re: Strange error message

Thanks I don't know what happened with the bracket, it's there in my code.

As far as !branch! syntax is concerned I haven't heard of that, let me investigate.
by ferrad
28 Mar 2014 03:43
Forum: DOS Batch Forum
Topic: Strange error message
Replies: 7
Views: 4356

Re: Strange error message

OK thanks, mystery 1 solved. Now mystery 2: Here's the actual code: if "%branch%" == "" %tr%mksecho ...branch not set, using: \c %tr%sed "s/.*:\\.*h\\\(.*\)\\BOC.*/\1/g" <%techroot%\Dev\TestHarness\TestEngineGUI\bin\Debug\DLLorigin.txt %tr%mksecho set branch=\c>%temp%\a...
by ferrad
28 Mar 2014 03:13
Forum: DOS Batch Forum
Topic: Strange error message
Replies: 7
Views: 4356

Re: Strange error message

There's still something wrong: when I execute the sed statement on its own, all works fine: vv1.bat: sed s/.*:\\.*h\\\(.*\)\\BOC.*/\1/g <d:\ReOTech\Dev\TestHarness\TestEngineGUI\bin\Debug\DLLorigin.txt D:\BuildTools>vv1 D:\BuildTools>sed s/.*:\\.*h\\\(.*\)\\BOC.*/\1/g 0<d:\ReOTech\Dev\TestHarness\Te...
by ferrad
28 Mar 2014 02:32
Forum: DOS Batch Forum
Topic: Strange error message
Replies: 7
Views: 4356

Strange error message

I have the following bit of batch code in vv.bat: set branch=%1 if /%branch%/ == // echo blah if /%branch%/ == // ( echo ...branch not set goto :EOF ) else ( echo 0 if /i /%branch%/ == /Main/ ( echo 1 ) else ( if /i /%branch:~0,7%/ == /Release/ ( echo 2 ) else ( echo 3 ) ) ) If I run this with no ar...