Page 1 of 1

The option to peek into a file rather than load it

Posted: Tue Jan 23, 2007 7:53 pm
by Ryck
There are times when all I need to do is inspect the beginning three to five lines of a file rather than load the whole thing -- just to see if the file has a file header and give me an idea what data values I'm getting prior to loading into my databases.

In those cases I need TextPad simply as a file inspecter rather than an editor. I don't need the whole file loaded. Especially when the file is HUGE! We're talking about 500 megabytes and higher.

If the TextPad programmer can add the option to load just the first few lines and stop loading - it would be a big time saver and a big convenience.

Posted: Tue Jan 23, 2007 8:21 pm
by MudGuard
get yourself a tail utility.

Usually
tail -+5 filename
displays the first 5 lines of a file, while
tail -5 filename
displays the last 5 lines ...

Posted: Wed Jan 24, 2007 1:07 pm
by bveldkamp
No need to search+download a separate utility:
"MORE filename", then Ctrl+C after the first page.

Posted: Fri Aug 17, 2007 5:59 pm
by munsey
Could TextPad be enhanced to be able to do this? I am interested in using TextPad as a log viewer/monitor. Perhaps another option in the "When files are modified by another process" group, have a tail -f option.

Posted: Fri Aug 17, 2007 11:58 pm
by Bob Hansen
Create a TextPad Tool using bveldkamp's solution with MORE.

Posted: Sun Aug 26, 2007 4:47 pm
by Zhiroc
If you have perl installed (and who doesn't? :) ), here's a cheap "head" function:

Code: Select all

perl -pe "exit if $. > 5" file.txt
(This works in a Command Window, you might have to play with the quoting, etc. to make it a tool.

The only problem is that textpad doesn't have a generic file selector dialog to feed a filename easily to a tool. The best you could do is to type in the filename using the "prompt for parameters" option, unless I'm missing something.