Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2008-10-01
3
Medium Priority
?
240 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 2000 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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

AutoHotkey is an excellent, free, open source programming/scripting language for Windows. It started out as a keyboard/mouse macros product, but has expanded into a robust language. This article provides an introduction to it, with links to addition…
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

618 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