You are not logged in.
Hi
The image viewer is pretty fast, as it opens the next image files.
I have a 300+ files folder. Is it possible to read these small files like an image viewer?
thankyou
Last edited by makh (2019-01-14 03:28:22)
OS: Arch &/ Debian
System: LENOVO ThinkPad E14
Desktop: Xfce
Offline
Hello,
There isn't any context in this request, are we suppose to know what you are talking about?
Regards
Offline
for name in *; do echo "$name"; cat "$name"; echo "=========================================="; done | lessShows all files in one pager, but bugsmaangement is right: you need to be more precise on what you expect.
Also read into some bash basic tutorials.
Online
@makh, I afraid to lie you, but it seems that `ranger` file manager allow to do what you want.
Last edited by Kirill Bugaev (2019-01-03 15:10:57)
Offline
@makh, I afraid to lie you, but it seems that `ranger` file manager allow to do what you want.
Hi
Its excellent, for English. But I will also need to learn it.
But ranger doesnt supports my other languages Urdu/Arabic, unfortunately!
I was thinking of some idea to convert all to image files or perhaps join into one document file. But it doesnt seem so nice.
For a while ranger will do!
Thanks a lot
OS: Arch &/ Debian
System: LENOVO ThinkPad E14
Desktop: Xfce
Offline
ranger doesnt supports my other languages Urdu/Arabic
Errrr… what?
If it's some text, you can display it - maybe you need a monospace font w/ better utf-8 coverage?
Online
Hello,
There isn't any context in this request, are we suppose to know what you are talking about?
Regards
Hi
Actually I made a lot of files on some important notes. Those points are now scattered in a huge volume of files. It looked cute and easy in the start, but not any more.
Sorry! I didnt explain well.
Now I have issue in slow opening and viewing of files. But ranger solves my issue by 50%.
Thankyou
OS: Arch &/ Debian
System: LENOVO ThinkPad E14
Desktop: Xfce
Offline
#!/bin/sh
tmpfile=/tmp/my_notes.html
cat <<EOF >| $tmpfile
<!DOCTYPE html>
<html>
<head>
<title>Overview of files in $1</title>
</head>
<body>
EOF
for f in $(find $1 -maxdepth 1 -type f -name '*.txt'); do
printf '<h1>%s</h1><pre>' "$f" >> $tmpfile
cat "$f" >> $tmpfile
printf '</pre>' >> $tmpfile
done
cat <<EOF >> $tmpfile
</body>
</html>
EOF
$BROWSER $tmpfilePass this script the directory you want to check and it will open all the files in one page in your browser assuming BROWSER is set, replace that as needed. Also adjust the find command as needed to include all the files you want and no others. Add any css you want in the html of the script.
Last edited by Trilby (2019-01-03 19:52:23)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
@Trilby, thanks a lot for script, but it doesn't support files with spaces in name. For example, if I have "/data/howtos/AUR upgrade.txt" file, parts "/data/howtos/AUR" and "upgrade.txt" will be consistently assignment to `f` variable and shell will evaluate them as two different files. Maybe this will be more suitable.
#!/bin/sh
tmpfile=/tmp/my_notes.html
cat <<EOF >| $tmpfile
<!DOCTYPE html>
<html>
<head>
<title>Overview of files in $1</title>
</head>
<body>
EOF
#for f in $(find $1 -maxdepth 1 -type f -name '*.txt'); do
for f in "$1"/*.txt; do
printf '<h1>%s</h1><pre>' "$f" >> $tmpfile
cat "$f" >> $tmpfile
printf '</pre>' >> $tmpfile
done
cat <<EOF >> $tmpfile
</body>
</html>
EOF
$BROWSER $tmpfileLast edited by Kirill Bugaev (2019-01-03 22:03:14)
Offline
deleted
Last edited by Kirill Bugaev (2019-01-03 21:49:52)
Offline
deleted
Do not do this. Read the full Code of Conduct before you post again.
All the best,
-HG
Offline
Oops, yes, this is better:
find "$1" -maxdepth 1 -type f -name '*.txt' | while read f; doFind is handy as you can do more complex filtering and/or include sub-directories. But if none of that is needed, use whatever works. I don't actually use such a script. If I want to find a specific file in a set of files with some text in it, I don't eyeball them, I use `grep -l $pattern`.
Last edited by Trilby (2019-01-03 22:05:02)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Untested, probably some escape errors ;-)
find $1 -maxdepth 1 -type f -name '*.txt' -exec printf '<h1>%s</h1><pre>' {} >> $tmpfile \; -exec cat "{}" >> $tmpfile \; -exec printf '</pre>' >> $tmpfile \;Online
Note that "find" does not sort in the usual lexical manner. If OP requires the files to be output in an intuitive order, any output from find will need to be piped through "sort" first
Offline
Hi
Oops, yes, this is better:
find "$1" -maxdepth 1 -type f -name '*.txt' | while read f; do
This fails to work! I get nothing as output.
@Seth:
find $1 -maxdepth 1 -type f -name '*.txt' -exec printf '<h1>%s</h1><pre>' {} >> $tmpfile \; -exec cat "{}" >> $tmpfile \; -exec printf '</pre>' >> $tmpfile \;
bash: $tmpfile: ambiguous redirectNo results..!
Thankyou
OS: Arch &/ Debian
System: LENOVO ThinkPad E14
Desktop: Xfce
Offline
Yeah, "tmpfile" is a variable in Trilby's script - please don't randomly copy&paste stuff into your shell.
Online
And $1 is a positional parameter assuming you'd put this in a script and pass the script a path/directory.
EDIT: and more importantly, that line was not a complete command but an excerpt/revision of the previous script. On it's own it's obviously incomplete.
Last edited by Trilby (2019-01-10 19:29:37)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline