Text File Editing Help Required.

Reply

Join Date: Jan 2007
Posts: 28
Reputation: coolvision is an unknown quantity at this point 
Solved Threads: 0
coolvision coolvision is offline Offline
Light Poster

Text File Editing Help Required.

 
0
  #1
Jan 24th, 2007
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.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,266
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: Text File Editing Help Required.

 
0
  #2
Jan 25th, 2007
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)
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 28
Reputation: coolvision is an unknown quantity at this point 
Solved Threads: 0
coolvision coolvision is offline Offline
Light Poster

Re: Text File Editing Help Required.

 
0
  #3
Jan 25th, 2007
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.
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 3,210
Reputation: MidiMagic has a spectacular aura about MidiMagic has a spectacular aura about 
Solved Threads: 165
MidiMagic's Avatar
MidiMagic MidiMagic is offline Offline
Nearly a Senior Poster

Re: Text File Editing Help Required.

 
0
  #4
Jan 26th, 2007
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.
Daylight-saving time uses more gasoline
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 28
Reputation: coolvision is an unknown quantity at this point 
Solved Threads: 0
coolvision coolvision is offline Offline
Light Poster

Re: Text File Editing Help Required.

 
0
  #5
Jan 26th, 2007
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.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,266
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: Text File Editing Help Required.

 
0
  #6
Jan 26th, 2007
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, 5 views)
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 148
Reputation: ghostdog74 is on a distinguished road 
Solved Threads: 40
ghostdog74 ghostdog74 is offline Offline
Junior Poster

Re: Text File Editing Help Required.

 
0
  #7
Jan 27th, 2007
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.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,266
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: Text File Editing Help Required.

 
0
  #8
Jan 27th, 2007
I get the error...

%%i was unexpected at this time
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,266
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: Text File Editing Help Required.

 
0
  #9
Jan 27th, 2007
Ah you need to wrap it up as a bat file. (Strange)
Last edited by iamthwee; Jan 27th, 2007 at 10:36 am.
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 148
Reputation: ghostdog74 is on a distinguished road 
Solved Threads: 40
ghostdog74 ghostdog74 is offline Offline
Junior Poster

Re: Text File Editing Help Required.

 
0
  #10
Jan 27th, 2007
Originally Posted by iamthwee View Post
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Windows NT / 2000 / XP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC