Computing.Net > Forums > Programming > how to add a text in a file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

how to add a text in a file

Reply to Message Icon

Name: navin499
Date: July 21, 2009 at 06:35:58 Pacific
OS: Windows Vista
Subcategory: Batch
Comment:

i want to add a text say Hi before every line in a text file..
say if i have a file abc.txt
and its body contains
This is India
India is a great country
Its too cold over here.

i want my output of the file should be like
Hi This is India
Hi india is a great country
Hi its very cold over here.
Cn any1 help me regarding this.
Thanks



Sponsored Link
Ads by Google

Response Number 1
Name: Bhas
Date: July 29, 2009 at 05:26:12 Pacific
Reply:

first create user defined bullet numbering as to hi
then u can use the word hi in every line by applying that bullet


0

Response Number 2
Name: d4rkcell
Date: July 29, 2009 at 07:04:17 Pacific
Reply:

See below, is this ok?

open notepad, copy and paste below into file.

@echo off
@FOR /F %%a IN (c:\abc.txt) DO echo hi %%a

save file as c:\names.bat, ensure abc.txt is on the root of C:

open command prompt and type c:\names.bat and press enter.

You could pipe this out to a file if you like.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Copy folders, rename file... remove words from a varia...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: how to add a text in a file

how to add a namespace to VB code www.computing.net/answers/programming/how-to-add-a-namespace-to-vb-code/6142.html

add or replace text in .txt file www.computing.net/answers/programming/add-or-replace-text-in-txt-file/18121.html

Batch to add the column in a txt file www.computing.net/answers/programming/batch-to-add-the-column-in-a-txt-file/19625.html