Solved

Batch file to add 2 X 0's to a text file.

Posted on 2008-10-01
3
224 Views
Last Modified: 2012-05-05
I have a text file - containing data such as:

   AAJO011180A06755240105A    88.00309200810540
    AAJO011180A06755240105A    66.01009200811270
    AAJO011180A06755240105A   106.01709200810560
    AAJO011180A06755240105A    86.0240920081037L
    ACCE011180A067ADB30105A   190.00409200813570
    ACCE011180A067ADB30105A    68.0180920081342L
    AFAD011180200DF11E0105A   272.00109200810390
    AFAD011180200DF11E0105A    22.00809200810320
    AFAD011180200DF11E0105A    38.01509200810380
    AFAD011180200DF11E0105A    28.0220920081039L

I need a batch file or similar to add 2 zeros after the 4th Letter ie AAJO011180A06755240105A     will become AAJO00011180A06755240105A.

Any help will be appreciated.
test.txt
0
Comment
Question by:grahamsmyth
  • 2
3 Comments
 
LVL 67

Accepted Solution

by:
sirbounty earned 500 total points
ID: 22617845

Set output=NewFile.txt

for /f "delims=" %%a in (test.txt) do call :process "%%a"

goto :eof
 

:process

set strData=%~1

set head=%strData:~0,4%

set tail=%strData:~4%

echo %strData%

echo %head%

echo %tail%

echo %head%00%tail% >> %output%

Open in new window

0
 
LVL 2

Author Closing Comment

by:grahamsmyth
ID: 31502115
Absolutely perfect - thanks very much!
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 22618265
Happy to help - thanx for the grade! :^)
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

This article was inspired by a question here at Experts Exchange (http://www.experts-exchange.com/Software/Photos_Graphics/Images_and_Photos/Q_28629170.html). The requirements stated in that question are (1) reduce the file size of a large number of…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now