AWK

    seq 5 | awk '{sum+=$1} END {print sum}'

useful for splitting columns

ls -lh | awk '{ print $2 }'

just outputs the 2nd column (which is the package name)

    dpkg --list | grep linux-image | awk '{ print $2 }'

SED

basic edit

sed -i 's/ugly/beautiful/g' /home/usr/test.txt

batch edit

#!/bin/bash
for filename in *.php; do
    # backup old file
    mv $filename $filename.bck
    # edit file
    sed 's/FINDSTRING/REPLACESTRING/g' $filename.bck > $filename
 
    echo $filename.bck
    #rm -f $filename.bck
done

find eand edit:

find /home/usr/test -type f -exec sed -i 's/ugly/beautiful/g' {} \;

add line at beginning of text file:

sed -'1s/^/text text\n/' file.txt

Notice: Undefined variable: browserName in /var/www/taziomirandola.it/lib/Visitors.php on line 86

Notice: Undefined variable: browserName in /var/www/taziomirandola.it/lib/Visitors.php on line 96

Deprecated: strripos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in /var/www/taziomirandola.it/lib/Visitors.php on line 96

Notice: Undefined index: HTTP_ACCEPT_LANGUAGE in /var/www/taziomirandola.it/lib/Visitors.php on line 39

Fatal error: Uncaught TypeError: Argument 1 passed to safe_text() must be of the type string, null given, called in /var/www/taziomirandola.it/lib/Visitors.php on line 39 and defined in /var/www/taziomirandola.it/lib/Visitors.php:162 Stack trace: #0 /var/www/taziomirandola.it/lib/Visitors.php(39): safe_text() #1 /var/www/taziomirandola.it/lib/Visitors.php(124): Visitors::getData() #2 [internal function]: Visitors::log() #3 {main} thrown in /var/www/taziomirandola.it/lib/Visitors.php on line 162