Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 368
  • Last Modified:

Text File modification

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
elwayisgod
Asked:
elwayisgod
  • 2
  • 2
1 Solution
 
Bill PrewCommented:
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
 
Martin LissRetired ProgrammerCommented:
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
 
elwayisgodAuthor Commented:
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
 
elwayisgodAuthor Commented:
Thanks... I just piped it via > and it gave me what I wanted.
0
 
Bill PrewCommented:
Welcome.

~bp
0

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now