No BSD License  

Highlights from
searchInFile

Be the first to rate this file! 3 Downloads (last 30 days) File Size: 1.8 KB File ID: #10717

searchInFile

by Stefan Eireiner

 

12 Apr 2006 (Updated 12 Apr 2006)

searches blockwise for a string or binary pattern in a file

| Watch this File

File Information
Description

SEARCHINFILE searches for a binary or string pattern in a file
 OFFSET = SEARCHINFILE(FILE, PATTERN)
 OFFSET = SEARCHINFILE(FILE, PATTERN, BLOCKSIZE)

The pattern may be a string or a line vector.

The blocksize is the maximum size in bytes which will be in memory while searching. If no blocksize is given then 10000 is assumed. The advantage of using a blockwise search is that you can search in very big files without using much memory.

The offset is the total offset in bytes to the first place of finding. If nothing was found then OFFSET = []

 Example:
  offset = searchinfile('bigfile.txt', 'searchstring', 20000);

Reads the file in 20000 Byte steps and searches for the searchstring. If it was found, the total offset to the beginning of the searchstring will be returned.

MATLAB release MATLAB 6.5 (R13)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
path Stefan Eireiner 22 Oct 2008 08:22:05
directories Stefan Eireiner 22 Oct 2008 08:22:05
files Stefan Eireiner 22 Oct 2008 08:22:05
file search binary string blockwise stepwise Stefan Eireiner 22 Oct 2008 08:22:05

Contact us at files@mathworks.com