You are here: Re: how to delete lines from text file « MsSQL Server « IT news, forums, messages
Re: how to delete lines from text file

Posted by Todd Vargo on 10/09/06 20:57

"batman" <uspensky@gmail.com> wrote in message
news:1160368462.065423.142350@m7g2000cwm.googlegroups.com...
> here is some actual content from the file (shortened ofcourse to just a
> few records) ideally i would like to avoid using a batch file and keep
> it all on the sql level (sql 2000).... the file pasted in here much
> perttier than it looks in notepad (with the squares)
>
> thanks for ur help
>
>
> ------ file starts below
snip...

In Windows 98 I would use the following (tested) batch which uses VBScript
to extract the portion indicated. The extract will be output to a file named
out.txt and opened in notepad for viewing. This batch should work in Windows
XP also (untested).

@echo off
echo> $.vbs filename = "test.txt"
echo>>$.vbs s = "START-OF-DATA"
echo>>$.vbs e = "END-OF-DATA"
echo>>$.vbs Set fso = CreateObject("Scripting.FileSystemObject")
echo>>$.vbs Set f = fso.GetFile(filename)
echo>>$.vbs filesize = f.size
echo>>$.vbs Set f = fso.OpenTextFile (filename, 1, True)
echo>>$.vbs fin = f.Read(filesize)
echo>>$.vbs f.close
echo>>$.vbs s = InStr(fin, s) + 15
echo>>$.vbs e = InStr(fin, e)
echo>>$.vbs clip = Mid(fin, s , e - s - 2)
echo>>$.vbs Wscript.Echo clip
cscript /nologo $.vbs > out.txt
del $.vbs
notepad out.txt

--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация