E=mc2
asked on
Script needed to replace or add carriage return when seeing spefic text
I would like a simple script in .bat, .vbs, or powershell, which will look into a .txt fle and do one of the following, whichever is easier to do:
1. Whenever it sees specific text such as AD, or DE, or BOG, or STOW.. that it will insert a tilde character (~) just before the text and then save the file with a new name.
OR
2. Whenever it sees the specific text such as AD, DE, BOG, or STOW, that it would start a new line which starts with those characters, and only start another line when it finds the next set of specific text.
The file resides at:
C:\Users\user\Desktop\fold er\file.tx t
And the output should be in the same folder but renamed to:
C:\Users\user\Desktop\fold er\fileR.t xt
1. Whenever it sees specific text such as AD, or DE, or BOG, or STOW.. that it will insert a tilde character (~) just before the text and then save the file with a new name.
OR
2. Whenever it sees the specific text such as AD, DE, BOG, or STOW, that it would start a new line which starts with those characters, and only start another line when it finds the next set of specific text.
The file resides at:
C:\Users\user\Desktop\fold
And the output should be in the same folder but renamed to:
C:\Users\user\Desktop\fold
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks very much.
Open in new window