Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Text File modification

Posted on 2012-03-28
5
Medium Priority
?
365 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 57

Accepted Solution

by:
Bill Prew earned 2000 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 49

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 57

Expert Comment

by:Bill Prew
ID: 37783231
Welcome.

~bp
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
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…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

715 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