Search found 93 matches
- 10 Jan 2014 19:04
- Forum: DOS Batch Forum
- Topic: Drawing pixel resolution graphics in text mode
- Replies: 25
- Views: 54138
Re: Drawing pixel resolution graphics in text mode
using cscript jscript? how about one only in DOS batch?
- 09 Jan 2014 02:59
- Forum: DOS Batch Forum
- Topic: Awk - A nifty little tool for text manipulation and more.
- Replies: 30
- Views: 36802
Re: Awk - A nifty little tool for text manipulation and more
Endoro wrote:We cannot get the cmd %ERRORLEVEL% here.
defined explicit exit if you want
Code: Select all
C:\> awk "BEGIN{ if ((\"ddd\" | getline) <= 0 ) exit(-1) ; }" 2>nul
C:\>echo %errorlevel%
-1
- 09 Jan 2014 00:43
- Forum: DOS Batch Forum
- Topic: Ways to aware that some string contains a substrings
- Replies: 24
- Views: 23780
Re: Ways to aware that some string contains a substrings
Should I quote some of your previous posts about you saying things about being smart and you know what I mean. I think you know what I mean by portable. well then obviously we have different wave length. I am also sure you know I am not talking about that kind of "portable". Shall we stop...
- 08 Jan 2014 18:09
- Forum: DOS Batch Forum
- Topic: Awk - A nifty little tool for text manipulation and more.
- Replies: 30
- Views: 36802
Re: Awk - A nifty little tool for text manipulation and more
I guess there could be instances when you could not test for the existence of a file but I am not sure when. awk internally doesn't have a mechanism for checking file existence such as -f test for linux. so most of the time if you want to do that then have to make a system call , OR to call getline...
- 08 Jan 2014 09:27
- Forum: DOS Batch Forum
- Topic: Awk - A nifty little tool for text manipulation and more.
- Replies: 30
- Views: 36802
Re: Awk - A nifty little tool for text manipulation and more
sorry SIR, but you need an update of your manual. 'getline' NEVER returns a negative value. And even beginners should learn, never to read from a non-existing file .... its not my manual. If you have doubts, please write to the contributors and ask them. sometimes you don't have the luxury to know ...
- 08 Jan 2014 08:30
- Forum: DOS Batch Forum
- Topic: Ways to aware that some string contains a substrings
- Replies: 24
- Views: 23780
Re: Ways to aware that some string contains a substrings
Squashman wrote:siberia-man wrote:PERL, or migrate to CYGWIN shell.
But then your script doesn't become very portable if others need to use it.
actually writing all these languages SHOULD be "portable", as long as there is the appropriate interpreters and the environment etc.
- 08 Jan 2014 08:27
- Forum: DOS Batch Forum
- Topic: Awk - A nifty little tool for text manipulation and more.
- Replies: 30
- Views: 36802
Re: Awk - A nifty little tool for text manipulation and more
instead of 'while (expression > 0)' we can simply write in awk 'while (expression)', the expression '> 0' is always 'true', and '= 0' is 'false'. Please check the manual "getline returns 1 if it finds a record, and 0 if the end of the file is encountered. If there is some error in getting a re...
- 08 Jan 2014 04:47
- Forum: DOS Batch Forum
- Topic: Awk - A nifty little tool for text manipulation and more.
- Replies: 30
- Views: 36802
Merging strings of similar items (keys).
Sometimes you many want to merge a collection of similar items. eg C_1,KOG0155 C_1,KOG0306 C_2,KOG3259 C_3,KOG0931 C_2,KOG3638 C_4,KOG0956 C_6,KOG0155 C_1,KOG0306 C_3,KOG3259 C_4,KOG0931 C_5,KOG3638 C_1,KOG0956 to become something like this: C_1,KOG0155 ,KOG0306,KOG0306,KOG0956 C_2,KOG3259, KOG3638 ...
- 08 Jan 2014 04:34
- Forum: DOS Batch Forum
- Topic: Ways to aware that some string contains a substrings
- Replies: 24
- Views: 23780
Re: Ways to aware that some string contains a substrings
The foxidrive suggestion is almost the best. But it doesn't work in some specific cases when NEEDLE contains "=" or "*" symbols (in addition to the existing troubles with few specific symbols). Read my first post =) so why don't you show more on your specific cases. help us to h...
- 08 Jan 2014 00:21
- Forum: DOS Batch Forum
- Topic: Ways to aware that some string contains a substrings
- Replies: 24
- Views: 23780
Re: Ways to aware that some string contains a substrings
This is as robust as simple batch gets: @echo off set "string1=needleb" set "string2=aneedle" set "string3=aneedleb" if /i "|||%string1%"=="|||needle%string1:needle=%" echo needle is at the beginning if /i "%string2%|||"=="%string2:ne...
- 08 Jan 2014 00:10
- Forum: DOS Batch Forum
- Topic: sub strings extraction from multiline output
- Replies: 18
- Views: 16574
Re: sub strings extraction from multiline output
foxidrive wrote:Mahendra wrote:Don't mind me, it's just one of my petty annoyances.
lol, foxi i think this happens quite common in forums.
- 07 Jan 2014 21:40
- Forum: DOS Batch Forum
- Topic: sub strings extraction from multiline output
- Replies: 18
- Views: 16574
Re: sub strings extraction from multiline output
Mahendra wrote:is there anyway without using any third party tools..i.e pure batch script.
then have you tried the batch solutions others posted?
- 07 Jan 2014 20:05
- Forum: DOS Batch Forum
- Topic: Ways to aware that some string contains a substrings
- Replies: 24
- Views: 23780
Re: Ways to aware that some string contains a substrings
But it will have performance issues in loops. just curious , how? you mean grepping for strings while iterating a big file? I was wondering the same thing as I used to do bash scripting many years ago. I hope he is not referring to the cardinal sin of piping cat to grep. something like this while r...
- 07 Jan 2014 20:02
- Forum: DOS Batch Forum
- Topic: sub strings extraction from multiline output
- Replies: 18
- Views: 16574
Re: sub strings extraction from multiline output
awk script function strip( string ){ # remove anything from beginning to the first ( , # and remove anything from last bracket ) till the end gsub( /.*\(|\).*/ , "", string ) return string } BEGIN{ RS="\n\n+" # set record separator to be more than 1 newlines FS="[ \n]+"...
- 07 Jan 2014 19:27
- Forum: DOS Batch Forum
- Topic: Ways to aware that some string contains a substrings
- Replies: 24
- Views: 23780
Re: Ways to aware that some string contains a substrings
siberia-man wrote:But it will have performance issues in loops.
just curious , how? you mean grepping for strings while iterating a big file?