Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Text File modification

Posted on 2012-03-28
5
345 Views
Last Modified: 2012-06-21
I have a giant file, but it's too big to open up in any editor thus I don't know what the delimiter is.  Is there a script that can just take the first 100 lines of it to a new file and not change the original at all?
0
Comment
Question by:elwayisgod
  • 2
  • 2
5 Comments
 
LVL 53

Accepted Solution

by:
Bill Prew earned 500 total points
ID: 37778344
At a DOS command prompt do a MORE command with the file name and you should get just one screen of data, should give you a look at the file.  Then do a CRTL-C to quit the MORE command.

~bp
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 37778425
Just in case


Dim stLine As String
dim lngIndex As Long

Open "path and name of file" For Input As #1
Open 'path and name of new file" For Output As #2
For lngIndex = 1 to 100
    Line Input #1, strLine
    Print #2 strLIne
    Next
Loop
Close
0
 

Author Comment

by:elwayisgod
ID: 37781985
I run that script and get:


C:\temp\Scripts\scripts\100Lines.vbs(1, 12) Microsoft VBScript compilation error
: Expected end of statement


Dim stLine As String
dim lngIndex As Long

Open "C:\temp\Scripts\Original\pricepointdata_commercial.txt" For Input As #1
Open "C:\temp\Scripts\Original\100_commercial.txt" For Output As #2
For lngIndex = 1 to 100
    Line Input #1, strLine
    Print #2 strLIne
    Next
Loop
Close
0
 

Author Closing Comment

by:elwayisgod
ID: 37783222
Thanks... I just piped it via > and it gave me what I wanted.
0
 
LVL 53

Expert Comment

by:Bill Prew
ID: 37783231
Welcome.

~bp
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question