Wednesday, May 15, 2019

File is too big to be opened by Notepad++

When I tried to open 2.5 GB size text file in Notepad or Notepad ++, I encountered the exception “File is too big to be opened by Notepad++” 

File is too big to be opened by Notepad++
  
Now, how will we open and read this big size file. This blog will explain two approach to read the big size file by using Window PowerShell.

1.     You can simply view the all file content by using get-content command

PS C:\temp> get-content -path Sample.txt

get-content

  
You can apply filter on number of records partial view by using –totalCount option and you can view only first 1000 records.

PS C:\temp> get-content -path Sample.txt -totalcount 1000

totalCount


2.     You can import some segment of file content into another file by using set-content command and then you will be able to open this file.

PS C:\temp> get-content -path Sample.txt -totalcount 1000 | set-content path NewSample.txt


In above command, it imports first 1000 records into file “NewSample.txt”

And also you can skip records while creating new file

PS C:\temp> get-content -path Sample.txt -totalcount 1000 | Select-object -skip 100 | set-content path NewSample.txt

skip


In above command, first it skip 100 records and then rest 900 records will be imported into file “NewSample.txt”

No comments:

SQL Server - Identify unused indexes

 In this blog, we learn about the index usage information (SYS.DM_DB_INDEX_USAGE_STATS) and analyze the index usage data (USER_SEEKS, USER_S...