Solved

Text File modification

Posted on 2012-03-28
5
319 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 51

Accepted Solution

by:
Bill Prew earned 500 total points
Comment Utility
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 45

Expert Comment

by:Martin Liss
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks... I just piped it via > and it gave me what I wanted.
0
 
LVL 51

Expert Comment

by:Bill Prew
Comment Utility
Welcome.

~bp
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

743 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now