Search found 9 matches

by gunitinug
03 Dec 2017 19:05
Forum: DOS Batch Forum
Topic: find /v "" to get rid of blank lines
Replies: 6
Views: 17076

Re: find /v "" to get rid of blank lines

Squashman wrote:
03 Dec 2017 18:59
Do you see a regular expression option in the help file for the FIND command?
Yeh I googled a bit and find doesn't support regex.

But what about

Code: Select all

type file.txt | find /v ""
as an attempt to filter out blank lines?
by gunitinug
03 Dec 2017 17:10
Forum: DOS Batch Forum
Topic: find /v "" to get rid of blank lines
Replies: 6
Views: 17076

find /v "" to get rid of blank lines

Here's file.txt C:\Users\CMY\Desktop\test batch scripts\find v blank lines>type file.txt aaa bbb ccc ddd I want to get rid of blank lines... First of all, C:\Users\CMY\Desktop\test batch scripts\find v blank lines>type file.txt | findstr /v "^$" aaa bbb ccc ddd this works. But C:\Users\CMY\Desktop\t...
by gunitinug
23 Nov 2017 17:19
Forum: DOS Batch Forum
Topic: findstr slash not working a expected
Replies: 2
Views: 4911

findstr slash not working a expected

Code: Select all

c:\test batch scripts\errorlevel demo>echo "a b c /" | findstr /r "//"
FINDSTR: // ignored
FINDSTR: Bad command line
The process tried to write to a nonexistent pipe.
I was expecting output

Code: Select all

a b c /
THX
by gunitinug
19 Nov 2017 17:05
Forum: DOS Batch Forum
Topic: Using findstr /v on a string enclosed by quotation marks
Replies: 8
Views: 7834

Re: Using findstr /v on a string enclosed by quotation marks

I got it C:\Users\CMY\Desktop\test batch scripts\findstr\v switch>type persons.txt | findstr /v "\^" person1 person2 C:\Users\CMY\Desktop\test batch scripts\findstr\v switch>type persons.txt | findstr /r "\^" person1^ person2^ Used \ to escape ^ character........ on the link it used ^^ which didn't ...
by gunitinug
19 Nov 2017 16:49
Forum: DOS Batch Forum
Topic: Using findstr /v on a string enclosed by quotation marks
Replies: 8
Views: 7834

Re: Using findstr /v on a string enclosed by quotation marks

Squashman wrote:Read the help file. It should be evident what the /V switch does
/V Print only lines that do NOT contain a match.

I already read it.

I also looked at http://www.robvanderwoude.com/escapechars.php
for escaping ^ character.
by gunitinug
19 Nov 2017 16:41
Forum: DOS Batch Forum
Topic: Using findstr /v on a string enclosed by quotation marks
Replies: 8
Views: 7834

Re: Using findstr /v on a string enclosed by quotation marks

I understand... I got confused... Now I understand findstr works on lines. But I have another question about findstr /v. I have persons.txt person1^ person1 person2^ person2 Now I try C:\Users\CMY\Desktop\test batch scripts\findstr\v switch>type persons.txt | findstr /v "^^$" person1^ person1 person...
by gunitinug
18 Nov 2017 03:39
Forum: DOS Batch Forum
Topic: Using findstr /v on a string enclosed by quotation marks
Replies: 8
Views: 7834

Using findstr /v on a string enclosed by quotation marks

I echo hi logan^^ to terminal. I want to remove ^^ at the end The following works as intended... C:\Users\Logan>echo hi logan^^ | findstr /v "^^^^$" hi logan But if I echo "hi logan^^" it doesnt work as I intended... C:\Users\Logan>echo "hi logan^^" | findstr /v "^^^^""$" "hi logan^^" I want it to r...
by gunitinug
17 Nov 2017 02:22
Forum: DOS Batch Forum
Topic: for f parameter loop
Replies: 1
Views: 2294

for f parameter loop

I have

weather.txt
-------------
January,Snowy,02
February,Rainy,15
March,Sunny,25

and

main.cmd
-----------

Code: Select all

@echo off
for /f "tokens=1,3 delims=," %%m in (weather.txt) do (echo %%m %%t)
I expect output:
January 02
February 15
March 25

But I get

January %t
February %t
March %t


Help THX
by gunitinug
09 Nov 2017 20:06
Forum: DOS Batch Forum
Topic: problem with choice command
Replies: 3
Views: 3368

problem with choice command

@echo off CHOICE /C YNO /T 10 /D Y /M "Are you feeling awesome?" IF ERRORLEVEL 1 goto yes IF ERRORLEVEL 2 goto no IF ERRORLEVEL 3 goto other :yes echo you are awesome! goto end :no echo bad luck. goto end :other echo unique ;) goto end :end For every choice returns "you are awesome!". I'm expecting...