Quick tip if you ever need to add a linebreak to the end of a file manually for whatever reason, `echo >> filename` works.
Quick tip if you ever need to add a linebreak to the end of a file manually for whatever reason, `echo >> filename` works.
When you're dealing with plaintext data in a suspicious context, consider using `cat -v` where you'd usually use `cat`.
```
-v, --show-nonprinting
use ^ and M- notation, except for LFD and TAB
```
File this under #shell #functions I should have written years ago:
function grepc {
#Do a grep -c, but skipping files with no results
grep -c "$@" |grep -v ':0$'
}
P.S., the body of the parent #toot was created by a simple #shell #function:
function apod {
#Today's NASA Astronomy Picture of the Day info-fetcher
curl -sL 'https://apod.nasa.gov/apod/archivepix.html' \
|grep -m1 "[0-9][0-9]:" \
|sed 's/^/Date: /;
s|: *<a href="|\nURL: https://apod.nasa.gov/apod/|;
s/">/\nTitle: /; s/<.*$//'
echo
echo "#NASA #Astronomy #PictureOfTheDay"
}
#bash #ksh #mksh #shellScripting #unix #UnixShell #WebScraping #Scraping #HTML
Since people are going nuts online about how perfect February 2026 is... here you go:
~ $ cal feb 2026
February 2026
Su Mo Tu We Th Fr Sa
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
~ $ for x in {1900..2050}; do cal feb $x |grep -q "^ 1 " && echo $x; done
1903
1914
1920
1925
1931
1942
1948
1953
1959
1970
1976
1981
1987
1998
2004
2009
2015
2026
2032
2037
2043
Einleitung in die Linux Shell
Warum du die Shell kennen solltest Bevor Icons und Fenster die Bildschirme der Computer erobert haben, hast du Befehle eingegeben, um mit den meisten Computern zu interagieren. Auf UNIX-Systemen, von denen Linux abstammt, war das Programm, das diese Befehle interpretiert und verwaltet hat, die Shell. Du kannst dich darauf verlassen, dass die Shell unabhängig von deiner Linux-Distribution immer verfügbar ist. Sie ermöglicht dir, ausführbare Skriptdateien zu erstellen, Programme […]Rule/Yule 30 cellular automaton with a "band-pass" filter every few iterations. Done in the Bash shell using bitwise math, so each row/state is a single number of 63 bits.
#cellularautomata #cellularautomaton #rule30 #bitwiseoperators #textmode #textmodeart #oldskool #retrocomputing #unixshell #shellprogramming #xterm #joulu6 #xmastree #algorithmicart #algorist #mathart #laskutaide #ittaide #kuavataide #iterati
Umm, why didn't I do this... years ago??
~ $ wc pinglog.txt
387290 1549160 11618700 pinglog.txt
~ $ type commaify
commaify is a function
commaify ()
{
local expr='s/([0-9])([0-9]{3}\>)/\1,\2/g';
sed -E "$expr; $expr; $expr; $expr; $expr; $expr; $expr; $expr; $expr; $expr"
}
~ $ wc pinglog.txt |commaify
387,290 1,549,160 11,618,700 pinglog.txt