Solved

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

Posted on 2008-10-01
3
236 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you receive another warning that your shared drive is almost full and you have asked your users to clean out old files again and again, here is a single command that may help. This command will place all the files that have not been used rec…
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…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

724 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