Script (or method/s) to read many 'text' files in sequence..

Booting, installing, newbie
Post Reply
Message
Author
User avatar
craftybytes
Posts: 298
Joined: Fri 17 Nov 2006, 10:32
Location: QLD AUSTRALIA

Script (or method/s) to read many 'text' files in sequence..

#1 Post by craftybytes »

I'm not sure if the heading for this is explanative enough ..

What I'm looking for is any guidance (script / html or other methods) in how I can 'view' with a suitable 'text-viewer' program - ".txt" - files of varying sizes in sequence - much like calling up 'chapters' in a large book ..?

I have around 180 + 'text' files of varying sizes which I want to view in numerical / alphabetical sequence in a similar fashion as 'reading' the chapters in a book - and view them from within the same prog without leaving this prog to locate the next file in the sequence..!!

Any suggestions / comments will be much appreciated ..
3 x boot:- ASROCK VIA 'all-in-one' m/b; AMD Duron 1.8Ghz+; 1.0GB RAM; 20GB hdd (WinXP Pro); 80GB hdd (MEPIS 3.4-3/Puppy v2.15CE Frugal); 1GB USB pendrive (Puppy 2.15CE Frugal); CD/DVDRW; 17" LCD monitor; HSF 56k modem... MEPIS is great.. Puppy ROCKS..

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#2 Post by Lobster »

tuxcards which is a petget might do :)
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

GuestToo
Puppy Master
Posts: 4083
Joined: Wed 04 May 2005, 18:11

#3 Post by GuestToo »

you could type (or paste) this one line program in an rxvt console window:

Code: Select all

ls /tmp/*.txt | while read j ; do defaulttexteditor $j ; done
it will open each file in a directory with the default text editor, in alphabetical order ... when you close the text editor, the next file will be opened with the text editor

change the path to the files from /tmp/*.txt to the path you want ... for example, *.txt would process the .txt files in the current working directory ... /root/* would process all files in /root

to stop the program, press ctrl+C in the console window

you could use the file utility to test each file to determine whether it is a text file or not ... you could write a script like this:

Code: Select all

#!/bin/sh
ls /root/my-documents/* | while read j
  do
    file $j | grep -q text && defaulttexteditor $j
  done
you can use a web browser like Seamonkey or Firefox or Opera to view text files ... just type the path of the directory in the url address box ... for example, type /root to view the files in /root ... just click on the file you want to view, navigate as you would navigate web pages, open text files in tabs if you like

muggins
Posts: 6724
Joined: Fri 20 Jan 2006, 10:44
Location: hobart

#4 Post by muggins »

craftbytes,

for my two bobs worth, i reckon if you can put your text files into html format, then make a contents, or index, page in html, then you can use the makeself utility to create a self-extracting html document, using whatever browser you want. (i usually use dillo or phv because of their speed).

i think puppy has a text2html utility somewhere? you might have to insert hyperlinks into your text files, pointing at the next page etc.

pm me if you want.

User avatar
craftybytes
Posts: 298
Joined: Fri 17 Nov 2006, 10:32
Location: QLD AUSTRALIA

#5 Post by craftybytes »

Thanks all for the quick replies...

Lobster :- I'll have a look at "Tuxcards" and see if it will do .. TA..

GuestToo :- thanks for the 'code' snips - will try them out - hopefully make into one script to do it all ...

muggins :- yes I was considering the possibility of doing it with html - and may still do so - but - with around 180 odd files to add 'hyperlinks' etc, to - it maybe a little on the 'long time to do' side of things - STILL - worth further thoughts ..

TIA for all suggestions..
3 x boot:- ASROCK VIA 'all-in-one' m/b; AMD Duron 1.8Ghz+; 1.0GB RAM; 20GB hdd (WinXP Pro); 80GB hdd (MEPIS 3.4-3/Puppy v2.15CE Frugal); 1GB USB pendrive (Puppy 2.15CE Frugal); CD/DVDRW; 17" LCD monitor; HSF 56k modem... MEPIS is great.. Puppy ROCKS..

Post Reply