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 ..
Script (or method/s) to read many 'text' files in sequence..
- craftybytes
- Posts: 298
- Joined: Fri 17 Nov 2006, 10:32
- Location: QLD AUSTRALIA
Script (or method/s) to read many 'text' files in sequence..
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..
you could type (or paste) this one line program in an rxvt console window:
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:
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
Code: Select all
ls /tmp/*.txt | while read j ; do defaulttexteditor $j ; done
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
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.
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.
- craftybytes
- Posts: 298
- Joined: Fri 17 Nov 2006, 10:32
- Location: QLD AUSTRALIA
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..
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..