Solved

Text File modification

Posted on 2012-03-28
5
359 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
[X]
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
  • 2
  • 2
5 Comments
 
LVL 56

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 48

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 56

Expert Comment

by:Bill Prew
ID: 37783231
Welcome.

~bp
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

617 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