Asked By
anonymous
7060 points
N/A
Posted on - 04/18/2011
I want to insert no's into a txt file. I periodically get a lot of text files from a software which needs numbering. I want a script that can insert no's in from of each word in every line. Can anyone help me with a script to do it. Preferably a batch script.
I want to insert no’s into a txt (Text) file.
Here is a solution for you. Script that can insert no’s into a Notepad file Create a bat file and name it as you wish or as shown below:
Data marked in red is the place you need to change.
Insert this code in the bat file you created. Code starts here……………………………. @echo off setlocal set counter=1 for /F "tokens=*" %%G in (c:Oldfile.txt) do call :_process "%%G" goto :_end :_process echo %counter%. %~1 >> c:Newfile.txt set /A counter+=1 goto :eof :_end endlocal Code end’s Here……………………………….. Then create a txt file with the name “oldfile.txt” with the desired content in the file for which you want to place no’s.
And then double click on the “bat” file. It will create a file named “Newfile.txt”
Inside which now the data will look like this.
Hope this helps.
I want to insert no’s into a txt (Text) file.
HIP HIP HURRAY !
Thank you so much MR. Sharath Reddy. My boss always send me text files like this to number them. Usually each file have 10,000+ name and other details in it and asks me to complete it in less than 1 hour. Really its a difficult task to number each line. Now you guys really made it very easy. Thanks for the script MR. Sharath.
I really appreciate you in helping me from this crisis which I was facing more than 1 month.
Thanks to techyv.com
WE ALL CAN MAKE DIFFERENCE! YEAH NOW ITS VERY TRUE!