943,600 Members | Top Members by Rank

Ad:
You are currently viewing page 1 of this multi-page discussion thread
Jan 24th, 2007
0

Text File Editing Help Required.

Expand Post »
Hello Dears,
I have hundereds of text
files and every file have thousand of
lines and there is only one word at each
line. My problem is that I want to add a
word with every word in files.
Example:
files contains a words
hello
dani
google
yahoo
Now I want to add a word with every word
like that:
hellodear
daniweb
googleisbest
yahoodotherest
if your understad my problem plz reply me
how can I edit all of my files bcoz
manually editing will take very long
times, bcoz there is about millions words
in all files.
Thanks in Advance.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
coolvision is offline Offline
29 posts
since Jan 2007
Jan 25th, 2007
0

Re: Text File Editing Help Required.

Your example is too vague.

But you would need to write a program to do that. Give a better example and I could write it for you. (Maybe)
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005
Jan 25th, 2007
0

Re: Text File Editing Help Required.

Thanks for reply, actually, I have thousands of text files and every file contains thousands of lines and there is only one word on each line. Now I want to add/attach one more word with every signle word in all files. For example there is a word in a file "dani" I want to convert it to "daniweb". So, like this I want to edit all my files.

It would be much appreciated if you make a programme/script for this solution.

Thanks & Regards.
Reputation Points: 10
Solved Threads: 0
Light Poster
coolvision is offline Offline
29 posts
since Jan 2007
Jan 26th, 2007
0

Re: Text File Editing Help Required.

How is it supposed to know which word to add?

Does it always add the same word when it finds a particular word? Or is the same word always added in the same place in the file?

Are the words to be added add in a list?

If you always need to add the same words in the same places in the file, you might be able to trick Excel into doing the job for you.
Reputation Points: 730
Solved Threads: 181
Nearly a Senior Poster
MidiMagic is offline Offline
3,314 posts
since Jan 2007
Jan 26th, 2007
0

Re: Text File Editing Help Required.

I already tried doing it with Excel, but I failed to do that, and Yes there is same single word which I want to add with every word in files.
Any other Trick ? Or Plz you try it to do with Excel or any other utility.
Reputation Points: 10
Solved Threads: 0
Light Poster
coolvision is offline Offline
29 posts
since Jan 2007
Jan 26th, 2007
0

Re: Text File Editing Help Required.

Just make sure you unzip it first.

Right click on the folder and choose to unzip(extract folder)
Attached Files
File Type: zip thweeze.zip (135.6 KB, 22 views)
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005
Jan 27th, 2007
0

Re: Text File Editing Help Required.

if all you need is to add a specific word to the end of each line (which contains one word ), then a batch file will suffice. An example
@echo off
for /F  %%i in (file.txt) do echo %%iweb
This will add the word "web" to the current lines

output:
C:\test>test.bat
helloweb
daniweb
googleweb
yahooweb

If you need different specific words for each line, then its a different story.
Reputation Points: 75
Solved Threads: 44
Junior Poster
ghostdog74 is offline Offline
156 posts
since Apr 2006
Jan 27th, 2007
0

Re: Text File Editing Help Required.

I get the error...

%%i was unexpected at this time
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005
Jan 27th, 2007
0

Re: Text File Editing Help Required.

Ah you need to wrap it up as a bat file. (Strange)
Last edited by iamthwee; Jan 27th, 2007 at 10:36 am.
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005
Jan 27th, 2007
0

Re: Text File Editing Help Required.

Click to Expand / Collapse  Quote originally posted by iamthwee ...
I get the error...

%%i was unexpected at this time
you got to run it in a batch file. If you run the for loop in a command shell, change %%i to %i
For ex, on command line
C:\test>@echo off
for /F  %i in (file.txt) do echo %iweb
helloweb
daniweb
googleweb
yahooweb
Reputation Points: 75
Solved Threads: 44
Junior Poster
ghostdog74 is offline Offline
156 posts
since Apr 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Windows NT / 2000 / XP Forum Timeline: boot problem
Next Thread in Windows NT / 2000 / XP Forum Timeline: Temporary Internet Files





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC