awk exclude beginning columns
Zurück zum Seitenanfang | Publiziert am
awk '{FS=" ";for(i=3;i<=NF;i++) printf("%s ",$i);printf( "\n");}'
Hier eine Sammlung nützlicher Befehle.
awk '{FS=" ";for(i=3;i<=NF;i++) printf("%s ",$i);printf( "\n");}'
echo | openssl s_client -connect rz.siegnetz.de.de:443 2> /dev/null | openssl x509 -noout -enddate
echo | openssl s_client -connect rz.siegnetz.de.de:443 2> /dev/null | openssl x509 -text
find / -depth -type d -exec /bin/sh -c 'printf "%5d %s\n" "$(find {} -type f -printf . | wc -c)" "{}"' \;|sort -n
lsof /var/log/syslog
lsof +D /var/log/
lsof -c ssh -c init
lsof /home
lsof -u rzimmermann
lsof -u ^rzimmermann
lsof -p 1753
kill -9 $(lsof -t -u rzimmermann)
lsof -u rzimmermann -c init
lsof -u rzimmermann -c init -a
lsof -u rzimmermann -c init -a -r10
lsof -i
lsof -i -a -c ssh
lsof -i :22
lsof -i tcp; lsof -i udp;
lsof -N -u lakshmanan -a
echo '{"json":"obj"}' | python -mjson.tool
echo "01110010 01111010 01101001 01101101 01101101 01100101 01110010 01101101 01100001 01101110 01101110 00001010" | perl -lape '$_=pack"(B8)*",@F'
tail -f /var/log/mail.log | perl -p -e 's/postfix/\\e\[31mpostfix\\e\[0m/'
Real ANSI colour codes look like ESC[<number>m where ESC is the character 27, and can be matched
using \\e in a perl regular expression. The number denotes the colour, possible codes are:
// common defines
#define NORMAL "\\e\[0m"
#define BOLD "\\e\[1m"
#define UNDERSCORE "\\e\[4m"
#define BLINK "\\e\[5m"
#define INVERSE "\\e\[7m"
// foreground colours
#define ANSI_BLACK "\\e\[30m"
#define ANSI_RED "\\e\[31m"
#define ANSI_GREEN "\\e\[32m"
#define ANSI_YELLOW "\\e\[33m"
#define ANSI_BLUE "\\e\[34m"
#define ANSI_PURPLE "\\e\[35m"
#define ANSI_CYAN "\\e\[36m"
#define ANSI_WHITE "\\e\[37m"
// background colours
#define ANSI_BACK_BLACK "\\e\[40m"
#define ANSI_BACK_RED "\\e\[41m"
#define ANSI_BACK_GREEN "\\e\[42m"
#define ANSI_BACK_YELLOW "\\e\[43m"
#define ANSI_BACK_BLUE "\\e\[44m"
#define ANSI_BACK_PURPLE "\\e\[45m"
#define ANSI_BACK_CYAN "\\e\[46m"
#define ANSI_BACK_WHITE "\\e\[47m"
$ while inotifywait -e modify /tmp/myfile; do firefox; done
tar cjf - | gpg --cipher-algo AES -c - > backup.tar.gpg
$ for i in 'find .'; do [ -d $i ] && chmod 755 $i || chmod 644 $i; done
$ find . ! -name file.txt -delete
$ openssl x509 -in filename.crt -noout -text
$ rename "s/ *//g" *.jpg
$ mogrify -geometry 800x600 *.jpg
-geometry (preserves values of height and width given, and aspect ratio)
$ munpack file.txt
$ rename 'y/A-Z/a-z/' *
$ ssh-keygen -R `host hostname | cut -d " " -f 4`
$ cut -f 2- -d " "
$ find . -type f -print0 | xargs -0 grep -i <pattern>
$ cat filename | uuencode filename | mail -s "Email subject" [email protected]
netstat -lantp | grep -i establ | awk -F/ '{print $2}' | uniq | sort
$ echo "123.32.12.134" | grep -P '([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5]
$ git add -u
It deletes all removed files, updates what was modified, and adds new files.
$ find -type d -empty -delete -print
$ file -i file.txt
$ awk '{print substr($0, index($0,$8)) }
Oder auch
$ cut -f N- file.txt
wget --reject html,htm --accept pdf,zip -rl1 rz.siegnetz.de
$ date -d @1234567890
sudo tail -f /var/log/squid3/access.log | awk '{ print strftime("%c ", $1) $0; }
$ awk '!a[$0]++' file
$ awk '!a[$0]++' file
$ dos2unix file.txt
$ swaks -from [email protected] -to [email protected] -server rz.siegnetz.de -q RCPT
$ openssl s_client -connect rz.siegnetz.de:25 -starttls smtp
$ convmv -r -f ISO-8859-1 -t UTF-8 --notest *
$ script -f /dev/pts/3
curl --write-out %{http_code} --silent --output /dev/null rz.siegnetz.de