Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Batch file to format text file

Status
Not open for further replies.

Strippierfsqefqerfqe

IS-IT--Management
Nov 25, 2009
6
GB
I have a text fiel which contains

[Google - Windows Internet Explorer]<LMouse>[Google News - Windows Internet Explorer]<LMouse>[DIY Book Scanners Turn Your Books Into Bytes | Gadget Lab | Wired.com - Windows nternet Explorer]<LMouse>

I need to get it into lines
ie..

[Google - Windows Internet Explorer]<LMouse>
[Google News - Windows Internet Explorer]<LMouse>
[DIY Book Scanners Turn Your Books Into Bytes | Gadget Lab | Wired.com - Windows Internet Explorer]<LMouse>

Effectvley the new line delimiter is the [ (start new line when see this character). I am thinking I need to use the DOS FOR command with TOKENS but not sure .....

Any help appreciated....

Thanks

 
You could do it manually pretty easily with a simple search & replace in Notepad++ (free).

Set the search Mode to Extended then search for <LMouse>and replace with <LMouse>\n.

You get the benefit of seeing the end result and being able to do an undo if it's wrong.

Jeff
[small][purple]It's never too early to begin preparing for [/purple]International Talk Like a Pirate Day
"The software I buy sucks, The software I write sucks. It's time to give up and have a beer..." - Me[/small]
 
@echo off

:: Create the assembler program, by Herbert Kleebauer
echo Bj@jzh`0X-`/PPPPPPa(DE(DM(DO(Dh(Ls(Lu(LX(LeZRR]EEEUYRX2Dx=> %temp%.\sbs2.com
echo 0DxFP,0Xx.t0P,=XtGsB4o@$?PIyU!WvX0GwUY Wv;ovBX2Gv0ExGIuht6>> %temp%.\sbs2.com
echo ?@}IKuNWpe~Fpe?FNHlF?wGMECIQqo{Ox{T?kPv@jeoSeIlRFD@{AyEKj@>> %temp%.\sbs2.com
echo iqe~1NeAyR?mHAG~BGRgB{~H?o~TsdgCYqe?HR~upkpBG?~slJBCyA?@xA>> %temp%.\sbs2.com
echo LZp{xq`Cs?H[C_vHDyB?Hos@QslFA@wQ~~x}viH}`LYNBGyA?@xAB?sUq`>> %temp%.\sbs2.com
echo LRy@PwtCYQEuFK@A~BxPtDss@fFqjVmzD@qBEOEenU?`eHHeBCMs?FExep>> %temp%.\sbs2.com
echo LHsPBGyA?@xAunjzA}EKNs@CA?wQpQpKLBHv?s`WJ`LRCYyIWMJaejCksl>> %temp%.\sbs2.com
echo H[GyFGhHBwHZjjHeoFasuFUJeHeB?OsQH[xeHCPvqFj@oq@eNc?~}Nu??O>> %temp%.\sbs2.com
echo ~oEwoAjBKs?Zp`LBzHQzyEFrAWAG{EFrAqAGYwHTECIQ{coKIsaCsf{Oe~>> %temp%.\sbs2.com
echo CK}Ayre~CNFA{rAyEKFACrA{EKGAjbA}eKGSjNMtQFtc{OAyDGFj?{FDGQ>> %temp%.\sbs2.com
echo KAjNVk_OCAx@e?f{o?CosI}1EGizhljJ~H1ZeG}JBA~rACBMDGjjDG@g0>> %temp%.\sbs2.com

:: Use the program
%temp%.\sbs2.com 0 "[" "$0D$0A[" < test.log > formatted.log

:: Delete the program
del %temp%.\sbs2.com

This works well...... Thanks to "Herbert Kleebauer
 
Would anyone trust such an assembly? Source code could be format c: ...

Cheers,
Dian
 
But so could any preassembled program :)

Robert Wilensky:
We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the Internet, we know this is not true.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top