I see that as well.
have a screenshot with the popup in it and the relevant parts marked in red by yours truly:

I see that as well.
The tee command might be unfamiliar to some but tee which comes in very handy at times, especially when you have a live system and want to capture outputs (e.g. from /var/log/messages ) even when the system would crash unexpectedly meaning any shutdown / reboot saving-current-settings into a module would fail even when the saving-current-settings script would incorporate saving of /var/log/messages.In computing, tee is a command in command-line interpreters (shells) using standard streams which reads standard input and writes it to both standard output and one or more files, effectively duplicating its input. It is primarily used in conjunction with pipes and filters. The command is named after the T-splitter used in plumbing.
Code: Select all
tail -fn 10 /var/log/messages|tee -a $myfile
Code: Select all
sensors|grep Core
Code: Select all
guest@rava:/usr/local/bin$ cat /usr/local/bin/mysensors.sh
#!/bin/sh
#V0.2
function tz () {
echo $(date +%d.%m.%Y\ %H:%M:%S) ____________________________________________________________
}
tz
sensors|grep Core
guest@rava:/usr/local/bin$ mysensors.sh
13.09.2023 06:36:51 ____________________________________________________________
Core 0: +63.0°C (high = +84.0°C, crit = +100.0°C)
Core 1: +62.0°C (high = +84.0°C, crit = +100.0°C)
Core 2: +63.0°C (high = +84.0°C, crit = +100.0°C)
Core 3: +62.0°C (high = +84.0°C, crit = +100.0°C)
Aside from what I wrote above already, I realized having two sound files chose from (my usual lowered in volume by -15 dB an the non-volume-changed original) can be useful at times, especially when I plan on watching some video (or maybe listening to audio) during the wait time and I want he dauerlalarm sound to be more loud and more annoying )
Code: Select all
notify-send -i info -t 0 "Encoding" "finished"
Thanks beny.Rava wrote: ↑18 Sep 2023, 11:48[Porteus supports the "3" kernel cheat code, add it to our kernel append parameter and you boot into init 3 (Slackware standard, Virtual Text terminals, multiuser, network)]
I prefer it that way as well, it takes a mere seconds to manually log in as guest and then typebut gives you much more control, also you can scroll up in the 1st terminal and review all boot messages even when they are already scrolled outside of the visible screen, something you cannot do when you boot into your XWindows and your chosen DE.Code: Select all
startx
Added in 3 minutes 59 seconds:
Cave! The scrolling up only works when you did not change to a different virtual terminal ("VT"). When you stay in one virtual terminal you can scroll up to see much more output of current program or from boot, but when you change the VT you can only access what is currently seen, all that is scrolled up is gone.
for those who do not know, scrolling up or scrolling down in a VT is done viaorCode: Select all
Shift + PageUp
Code: Select all
Shift + PageDown
Rava wrote: ↑18 Sep 2023, 14:09⬤ When using mc you can either navigate through the folders like usual (double-click or press return on a folder, move up by doing that on the ".." entry)
⬤ or just type in the command prompt below the command⬤ or start mc with the two folders you want to copy files in between.Code: Select all
cd /tmp
Let's assume your module is in /tmp/ and you have a symlink that links to your main Porteus modules folder called /Porteus_modules
then just typeUsually it would be enough to typeCode: Select all
mc /tmp/ /Porteus_modules
since by default there exists no folder or file in / that starts with a upper-case P like your link /Porteus_modules does.Code: Select all
mc /tmp/ /P[tab]
The [tab] then expands it to the only existing name -> /Porteus_modules
Yes, in some many cases using the terminal (and that includes mc) can let you do things quicker than a GUI equivalent especially when you use symlinks named in an easily remembered and unique way (as in: the first character of your symlink doesn't exist in that very folder aside from your symlink)
Code: Select all
#!/bin/sh
#based on mysensors.sh V0.2 and tail+tee_VLM.sh V0.2
function tz () {
echo $(date +%d.%m.%Y\ %H:%M:%S) ____________________________________________________________
}
if [ $UID -ne 0 ]; then
echo "$0: ERROR - start me as user root. Aborting."
exit 1
fi
mydate=$(date +%Y-%m-%d)
echo mydate suffix I am using: $mydate
myfile=sensors_$mydate
echo myfile I am using: $myfile - WILL OVERWRITE EXISTING ENTRIES
echo $(date +%d.%m.%Y\ %H:%M:sensors_%S) started: $0 >$myfile
while true; do { tz|tee -a $myfile; sensors|grep Core|tee -a $myfile ; sleep 1m ; } done
Code: Select all
guest@rava:/mnt/sda3/log$ ls -o sensors_2023-09-20
-rw-r--r-- 1 root 18618 2023-09-20 02:20 sensors_2023-09-20
Code: Select all
root@rava:/mnt/sda3/log# ./mysensorslog.sh
mydate suffix I am using: 2023-09-20
myfile I am using: sensors_2023-09-20 - WILL OVERWRITE EXISTING ENTRIES
20.09.2023 01:20:56 ____________________________________________________________
Core 0: +56.0°C (high = +84.0°C, crit = +100.0°C)
Core 1: +55.0°C (high = +84.0°C, crit = +100.0°C)
Core 2: +57.0°C (high = +84.0°C, crit = +100.0°C)
Core 3: +55.0°C (high = +84.0°C, crit = +100.0°C)
Code: Select all
20.09.2023 01:20:56 ____________________________________________________________
Core 0: +56.0°C (high = +84.0°C, crit = +100.0°C)
Core 1: +55.0°C (high = +84.0°C, crit = +100.0°C)
Core 2: +57.0°C (high = +84.0°C, crit = +100.0°C)
Core 3: +55.0°C (high = +84.0°C, crit = +100.0°C)
20.09.2023 01:21:56 ____________________________________________________________
Core 0: +55.0°C (high = +84.0°C, crit = +100.0°C)
Core 1: +52.0°C (high = +84.0°C, crit = +100.0°C)
Core 2: +56.0°C (high = +84.0°C, crit = +100.0°C)
Core 3: +52.0°C (high = +84.0°C, crit = +100.0°C)
20.09.2023 01:22:56 ____________________________________________________________
Core 0: +55.0°C (high = +84.0°C, crit = +100.0°C)
Core 1: +52.0°C (high = +84.0°C, crit = +100.0°C)
Core 2: +55.0°C (high = +84.0°C, crit = +100.0°C)
Core 3: +52.0°C (high = +84.0°C, crit = +100.0°C)
Code: Select all
tz|tee -a $myfile;
Code: Select all
echo -n >/mnt/sda3/log/sensors_2023-09-20
Code: Select all
tail -f /mnt/sda3/log/sensors_2023-09-20
Code: Select all
tail: /mnt/sda3/log/sensors_2023-09-20: file truncated
Code: Select all
root@rava:~# cd /mnt/sda3/log/
root@rava:/mnt/sda3/log/# ./mysensorslog.sh
Code: Select all
startx
Code: Select all
tail -f /mnt/sda3/log/sensors_2023-09-20
Code: Select all
for d in */ ; do printf 'make-ffplay-script %q\n' "${d%/}"; done > myfindloop_pjh.sh
chmod -v a+x myfindloop_pjh.sh
Code: Select all
for d in */ ; do echo make-ffplay-script \""$d"\"; done > myfindloop.sh
chmod -v a+x myfindloop.sh
Other essential reads:How can I find and safely handle file names containing newlines, spaces or both?
First and foremost, to understand why you're having trouble, read Arguments to get a grasp on how the shell understands the statements you give it. It is vital that you grasp this matter well if you're going to be doing anything with the shell.
The preferred method to deal with arbitrary filenames is still to use find(1):
or, if you need to handle filenames en masse:Code: Select all
find ... -exec command {} \;
xargs is rarely ever more useful than the above, but if you really insist, remember to use -0 (-0 is not in the POSIX standard, but is implemented by GNU and BSD systems):Code: Select all
find ... -exec command {} +
Use one of these unless you really can't.Code: Select all
# Requires GNU/BSD find and xargs find ... -print0 | xargs -r0 command # Never use xargs without -0 or similar extensions!
Another way to deal with files with spaces in their names is to use the shell's filename expansion (globbing). This has the disadvantage of not working recursively (except with zsh's extensions or bash 4's globstar), and it normally does not include hidden files (filenames beginning with "."). But if you just need to process all the files in a single directory, and omitting hidden files is okay, it works fantastically well.
For example, this code renames all the *.mp3 files in the current directory to use underscores in their names instead of spaces (this uses the bash/ksh extension allowing "/" in parameter expansion):
You can omit the "if..." and "fi" lines if you're certain that at least one path will match the glob. The problem is that if the glob doesn't match, instead of looping 0 times (as you might expect), the loop will execute once with the unexpanded pattern (which is usually not what you want). You can also use the bash extension "shopt -s nullglob" to make empty globs expand to nothing, and then again you can omit the if and fi.Code: Select all
# Bash/ksh for file in ./*\ *.mp3; do if [ -e "$file" ] ; then # Make sure it isn't an empty match mv "$file" "${file// /_}" fi done
For more examples of renaming files, see FAQ #30.
Remember, you need to quote all your Parameter Expansions using double quotes. If you don't, the expansion will undergo WordSplitting (see also argument splitting and BashPitfalls). Also, always prefix globs with "/" or "./"; otherwise, if there's a file with "-" as the first character, the expansions might be misinterpreted as options.
Another way to handle filenames recursively involves using the -print0 option of find (a GNU/BSD extension), together with bash's -d extended option for read:
The preceding example reads all the files under /tmp (recursively) into an array, even if they have newlines or other whitespace in their names, by forcing read to use the NUL byte (\0) as its line delimiter. Since NUL is not a valid byte in Unix filenames, this is the safest approach besides using find -exec. IFS= is required to avoid trimming leading/trailing whitespace, and -r is needed to avoid backslash processing. In fact, $'\0' is actually the empty string (bash doesn't support passing NUL bytes to commands even built-in ones) so we could also write it like this:Code: Select all
# Bash unset a i while IFS= read -r -d $'\0' file; do a[i++]="$file" # or however you want to process each file done < <(find /tmp -type f -print0)
So, why doesn't this work?Code: Select all
# Bash unset a i while IFS= read -r -d '' file; do a[i++]="$file" done < <(find /tmp -type f -print0)
Because of the pipeline, the entire while loop is executed in a SubShell and therefore the array assignments will be lost after the loop terminates. (For more details about this, see FAQ #24.)Code: Select all
# DOES NOT WORK unset a i find /tmp -type f -print0 | while IFS= read -r -d '' file; do a[i++]="$file" done
For a longer discussion about handling filenames in shell, see Filenames and Pathnames in Shell: How to do it Correctly.
CategoryShell
Highlighting to show you what I meant with 'add some "markers"' - if you just number the markers like in my example or give them unique descriptive names is up to you, usually I go by the more simple#!/bin/bash
code
more code
echo DEBUG - 1
even more code
echo DEBUG - 2
even more code 2
even more code 3
echo DEBUG - 3
even more code 4
# etcetera pp
Code: Select all
echo DEBUG1
[…]
echo DEBUG2
Code: Select all
echo DEBUG1:
echo 'variable1$ - ' "variable1$"
echo 'variable2$ - ' "variable2$"
[…]
echo DEBUG2:
echo 'variable1$ - ' "variable1$"
echo 'variable2$ - ' "variable2$"
Added in 34 minutes 55 seconds:Rava wrote: ↑16 Oct 2023, 05:11The obvious is you not thinking of using "--"Ed_P wrote: ↑15 Oct 2023, 23:19I know it's obvious to some but what am I missing??I know the "-2023" exists in the file.Code: Select all
guest@porteus:/mnt/sda6$ grep -i "-2023 " testdisk.log grep: invalid option -- ' ' Usage: grep [OPTION]... PATTERNS [FILE]... Try 'grep --help' for more information. guest@porteus:/mnt/sda6$ grep -i -2023 testdisk.log ^C guest@porteus:/mnt/sda6$ cat testdisk.log | grep -i -2023 >> testdisk2023.txt Usage: grep [OPTION]... PATTERNS [FILE]... Try 'grep --help' for more information. guest@porteus:/mnt/sda6$ cat testdisk.log | grep -i '-2023 ' >> testdisk2023.txt grep: invalid option -- ' ' Usage: grep [OPTION]... PATTERNS [FILE]... Try 'grep --help' for more information. guest@porteus:/mnt/sda6$ cat testdisk.log | grep -i "-2023 " >> testdisk2023.txt grep: invalid option -- ' ' Usage: grep [OPTION]... PATTERNS [FILE]... Try 'grep --help' for more information. guest@porteus:/mnt/sda6$ cat testdisk.log | grep -F "-2023 " >> testdisk2023.txt grep: invalid option -- ' ' Usage: grep [OPTION]... PATTERNS [FILE]... Try 'grep --help' for more information. guest@porteus:/mnt/sda6$ cat testdisk.log | grep -F '-2023 ' >> testdisk2023.txt grep: invalid option -- ' ' Usage: grep [OPTION]... PATTERNS [FILE]... Try 'grep --help' for more information. guest@porteus:/mnt/sda6$
Code: Select all
73575 -r--r--r-- 0 0 10759 16-Sep-2023 00:23 My Utilities/FirefoxPortable/Data/profile/cache2/entries/5A84833AC677669F92C22170A71045DD3B224619
When something starting with a "-" is getting you trouble, use it as the last given parameter together with a prior "--" - that tells all programs it's the end of all options.
Created a test file "dummy", here its contents, and one grep run with -- and one without:Does that help to get your train back on the correct track?Code: Select all
guest@rava:/tmp$ cat dummy blabla Kafkaesque -2023 blubbs Whatever Kafkaesque-2023 bla blablubb guest@rava:/tmp$ grep -i -- "-2023 " dummy -2023 blubbs Kafkaesque-2023 bla guest@rava:/tmp$ grep -i "-2023 " dummy /bin/grep: invalid option -- ' ' Usage: grep [OPTION]... PATTERNS [FILE]... Try 'grep --help' for more information. guest@rava:/tmp$
Also, you not need the "-i" parameter here. Unless you are able to show me upper case numbers and lower case numbers. And no, "2" vs "²" and "3" vs "³" do not count.
Is a mere "2" upper case or lower case? And if is is one, what is the other case?
Answer: Arabic numerals do not have upper or lower cases.
Roman numerals on the other hand can have these:
IV vs iv and XXI vs xxi and such, though usually Roman numerals are written as upper case only.
(highlighting by me)The ten Arabic numerals 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 are the most commonly used symbols for writing numbers.
Rava wrote: ↑16 Oct 2023, 06:54Could it be you defeated yourself by using Dr. Copy and Mr. Paste?
Why is there a whitespace at the end of grep -i .. ".sh " ?
And what is the ".." meant to be?
Could it be you meant to use a simple | grep ".sh"
Though, be aware that for grep executed likes so the "." in the ".sh" statement is meant as "any character", you have to escape the "." to make grep search for a literal ".".
──────────────────────────────────────────────────────────
What do you mean by "use multiple selections when reading the log file"
You can add a grep onto a grep:
would find all and any entries of "Azur Lane"Code: Select all
grep "Azur Lane" index.txt
Let's presume "index.txt" is created using find and thus has entries like so:When you only want to find all entries for "Azur Lane" and "/video/" then you use | and another grep like so:Code: Select all
/Random Folder/whatever.file /sound/Azur Lane/fan-music.mp3 /video/Azur Lane/Azur Lane 01.mp4 /video/Kantai Collection/Kantai Collection 01.mp4
When you want to find all "Azur Lane" hits but the "/video/" ones you use -v (Cave! In grep -v is not the same as -V and --version) like so:Code: Select all
grep "Azur Lane" index.txt | grep "/video/"
And when you want to combine several search patterns use -E like so to find all entries named "Azur Lane" and "Kantai Collection":Code: Select all
grep "Azur Lane" index.txt | grep -v "/video/"
Examples:Code: Select all
grep -E "Azur Lane|Kantai Collection" index.txt
If none of this is what you meant, please explain what you meant by "use multiple selections when reading the log file".Code: Select all
guest@rava:/tmp$ cat index.txt /Random Folder/whatever.file /sound/Azur Lane/fan-music.mp3 /video/Azur Lane/Azur Lane 01.mp4 /video/Kantai Collection/Kantai Collection 01.mp4 guest@rava:/tmp$ grep -E "Azur Lane|Kantai Collection" index.txt /sound/Azur Lane/fan-music.mp3 /video/Azur Lane/Azur Lane 01.mp4 /video/Kantai Collection/Kantai Collection 01.mp4 guest@rava:/tmp$ grep "Azur Lane" index.txt | grep "/video/" /video/Azur Lane/Azur Lane 01.mp4 guest@rava:/tmp$ grep "Azur Lane" index.txt | grep -v "/video/" /sound/Azur Lane/fan-music.mp3 guest@rava:/tmp$
Just searched through a gzipped text file via zless (that is just a wrapper for less) and was looking for a literal "0.6" and searching just for that gave me results for regex "0.6" as in its "." being regarded as "any character except newline"… e.g. this "4096" would be a hit, since it is "0"+"any character except newline"+"6"Rava wrote: ↑16 Oct 2023, 18:46[…]
Here snippet of how I escape the "." of filename extentions in my make-ffplay-script :To do it like so, you have to use both " and \ like in my code above.Code: Select all
grep -E "\.avi$|\.flv$|\.mp[34g]$|\.mkv$|\.ogv$|\.[tT][sS]$|\.webm$|\.divx$|\.[vV][oO][bB]$|\.ogg$|\.aac$"
Code: Select all
0\.6
Code: Select all
Money field:
100.00
90.00
1.50
How to get them to display as:
100.00
90.00
1.50
The same problem for date fields:
12 Aug 2023
2 Oct 2023
Looks pretty aligned to the right for me already?Ed_P wrote: ↑17 Oct 2023, 06:18Code: Select all
The same problem for date fields: 12 Aug 2023 2 Oct 2023
Seems you edited your article after I quoted it.
awk and print. awk can do that, and if by print you mean the printf function, that can do so as well. Alas! I hardly use these so I do not know the needed code necessary for accomplishing your goals off the top of my head. (I am more of a less and sed kind of guy)
Code: Select all
guest@rava:~$ ls --color=auto -d /mnt/sd[a-z][1-9]/ext[HU][DS]* /mnt/sd[a-z]/ext[HU][DS]* /mnt/sd[a-z][1-9]/intHD* /mnt/sd[a-z][1-9]/extSD* 2>/dev/null
/mnt/sda1/intHDD1_1
/mnt/sda1/intHDD1_1_Toshiba_Satellite_500GB_intern
/mnt/sda2/intHDD1_2
/mnt/sda3/intHDD1_2
/mnt/sda4/intHDD1_4
/mnt/sda5/intHDD1_5
/mnt/sda7/intHDD1_7
/mnt/sda8/intHDD1_8
/mnt/sdb1/extHD11
/mnt/sdb1/extHD11_1
/mnt/sdb1/extHD11_1_2TB_ex_SynologyNAS
/mnt/sdb3/extHD11_3
/mnt/sdb3/extHD11_3_2TB_ex_SynologyNAS
/mnt/sdc2/extHD13_2
/mnt/sdc2/extHD13_Toshiba_2,5"_1TB_USB3
/mnt/sdc3/extHD13_3
/mnt/sdc4/extHD13_4
/mnt/sdd1/extSD_2GB
/mnt/sdd1/extSD_2GB_SDcard
Code: Select all
cd /into/root-of-partition/
ls -loaR --time-style="+%Y-%m-%d %H:%M" >>"${TMPDIR}${base}.ls"
Code: Select all
cd /into/root-of-partition/
find . >>"${TMPDIR}${base}.find"
Code: Select all
TestDisk 7.2-WIP, Data Recovery Utility, August 2023
Code: Select all
root@rava:/Lsfind# file /welt/lsfind/lsfind.ext2
/welt/lsfind/lsfind.ext2: Linux rev 1.0 ext2 filesystem data (mounted or unclean), UUID=WhAt-EvEr, volume name "LSFIND" (large files)
root@rava:/Lsfind# ls -o /welt/lsfind/lsfind.ext2
-rw-r--r-- 1 root 80740352 2023-10-17 08:52 /welt/lsfind/lsfind.ext2
Code: Select all
root@rava:/Lsfind# /bin/df -Tm /Lsfind/
Filesystem Type 1M-blocks Used Available Use% Mounted on
/dev/loop19 ext2 71 68 4 96% /Lsfind
Code: Select all
root@rava:/Lsfind# help.dd.random+cp
help.dd.random+cp.sh V0.9
dd if=/dev/urandom of=random.data count=1024c bs=1 # prefered, more secure
dd if=/dev/random of=random.data count=1024c bs=1 # quicker? less secure!
dd if=/dev/hda of=cd.iso bs=2048 # copies nonprotected CD to file
dd if=/dev/sda1 of=sda1.mbr count=512c bs=1 # backups MBR of sda1 into file
dd if=/dev/zero of=16MB.img bs=1k count=16384 # creates an empty 16 MB file
dd if=/dev/zero of=1GB.file bs=1M count=1024 # creates an empty 1 GB file
-> then use mkfs.ext3 -F 1GB.file to create an ext3 fs
or for ext2 / lsfind:
--> dd if=/dev/zero of=lsfind.ext2 bs=1M count=60 # create 60 MB container
--> mkfs.ext2 -F lsfind.ext2 -L LSFIND # format
--> tune2fs -r 50 lsfind.ext2 # tune
"myNrg2iso" :P
dd skip=307200 if=image.nrg of=image.iso
Code: Select all
root@rava:/Lsfind# zgrep leafpad *gz|grep xzm$|grep -v leafpad-0.8.18.1
root@rava:/Lsfind#
Code: Select all
root@rava:/Lsfind# zgrep leafpad *gz|grep xzm$|wc
78 334 8207
Code: Select all
root@rava:/Lsfind# zgrep leafpad *gz|wc
515 1983 48127
Code: Select all
root@rava:/Lsfind# zgrep leafpad *gz|grep ".\xzm$"|wc
78 334 8207
root@rava:/Lsfind# zgrep leafpad *gz|grep xzm$|wc
78 334 8207
Code: Select all
guest@rava:/myvideo$ ls -d *sh/
Grimgar\ of\ Fantasy\ and\ Ash/
Code: Select all
zgrep whatever *gz|grep sh$
Code: Select all
zgrep whatever *gz|grep "\.sh$"