Search found 8 matches

by CMOS
20 Jun 2013 13:45
Forum: DOS Batch Forum
Topic: Return character of specific position in a line
Replies: 16
Views: 15709

Re: Return character of specific position in a line

Thank you for the links... I believe I'm starting to get it. With that said, I'm curious if given the same information given above if there's a way to extract the previous and subsequent line after finding a matching character? It's not entirely necessary but I'm interesting in if there are methods ...
by CMOS
18 Jun 2013 09:08
Forum: DOS Batch Forum
Topic: Return character of specific position in a line
Replies: 16
Views: 15709

Re: Return character of specific position in a line

It is a very bad practice to develop a program in "little steps" (when requirement A is fulfilled, request requirement B; when it is fulfilled request the C and so on) because is frequent that a posterior modification entirely replaces a previous one, so our efforts in the development of ...
by CMOS
12 Jun 2013 14:06
Forum: DOS Batch Forum
Topic: Return character of specific position in a line
Replies: 16
Views: 15709

Re: Return character of specific position in a line

How about posting your revised code? Sure... @echo off setlocal EnableDelayedExpansion (for %%a in (*.txt) do ( for /F "usebackq delims=" %%b in ("%%a") do ( set "line=%%b" if "!line:~9,1!" equ "A" ( echo !line! ) if "!line:~9,1!" equ &quo...
by CMOS
12 Jun 2013 10:11
Forum: DOS Batch Forum
Topic: Return character of specific position in a line
Replies: 16
Views: 15709

Re: Return character of specific position in a line

@echo off setlocal EnableDelayedExpansion rem I have text files (and receive more daily) that contain a varying number of lines (for %%a in (*.txt) do ( rem Each line contains 1000 characters rem I'd like to do is search each line of the file, for /F "usebackq delims=" %%b in ("%%a&q...
by CMOS
11 Jun 2013 17:22
Forum: DOS Batch Forum
Topic: Return character of specific position in a line
Replies: 16
Views: 15709

Re: Return character of specific position in a line

Sorry for the ambiguity, I'll try and explain better. I have text files (and receive more daily) that contain a varying number of lines, some nights it could be 400, others 387, others 245, etc... Each line contains 1000 characters and is formatted in a specific fashion. The 10th character of each l...
by CMOS
11 Jun 2013 12:33
Forum: DOS Batch Forum
Topic: Return character of specific position in a line
Replies: 16
Views: 15709

Return character of specific position in a line

Is it possible, using a batch file, to determine what character is in a certain position of a line in a text file? So if I have a text file and I want to check what character is in position 10 and perform a correlating function based on the result of the line, how can I do that? There are several po...
by CMOS
29 May 2013 10:27
Forum: DOS Batch Forum
Topic: Leading Spaces Batch File
Replies: 9
Views: 13374

Re: Leading Spaces Batch File

try this: @ECHO OFF Cls <nul set /p"=You have the following fruit ">>"Output.txt" for /F %%a in (fruit.txt) do ( <nul set /p"=%%a">>"Output.txt" <nul set /p"=,">>"Output.txt" ) I just wanted to follow up on this and say thank you to everyo...
by CMOS
23 May 2013 14:35
Forum: DOS Batch Forum
Topic: Leading Spaces Batch File
Replies: 9
Views: 13374

Leading Spaces Batch File

Hello, I have a batch file that reads a list of names from one file and appends to them to another file. So say File1 has 4 lines in it : Apples Pears Oranges Grapes I have a batch file that writes : You like the following fruit and then should list those four fruit on the same line : You like the f...