$IFS – Internal field separator. List of chars, that delimiter words ^= |= >>= <<=; relations: < <= > >= sed -e 'script' – stream editor, script y/ABC/abc/ replaces A, B, C Bourne-AgainBourne-Again SHell SHell and and Linux Linux CLI CLI from input, usually space, tabulator $' t' and new line $' n'. factor n – factorize into primes for a, b, c; s/regexp/substitution/ Floating point operations: echo "scale=10; 22/7" | bc tr a b – replace char a for b © 2013 Martin Bruchanov,
[email protected] •4. Script command line parameters • tr '[a-z]' '[A-Z]' < file.txt – change lowercase to uppercase $0, ${0} – name of script \ \ •8. Screen output 푛 Set interpreter: #!/bin/bash Remarks: # this is comment awk '/pattern/ {action }' file – process lines containing pattern $1 to $9, ${1} to ${255} – positional command line parameters • • echo "text" – print text, echo * print all files in current dir cut -d delimiter -f field – print column(s) 1. Interactive control $# – number of command line parameters (argc) echo -e "text" – interpret escape-sequences (\t tab., a beep, \f • • cmp file1 file2 – compare files and print first difference Action set -o vi set -o emacs $* – expand all parameters, "$*" = "$1 $2 $3 " new page, \n new line), -n, \c suppressing \n, \xHH hex-byte, nnn • • • diff, diff3, sdiff, vimdiff – compare whole files vi-command mode (C) Esc — $@ – expand all parameters, "$@" = "$1" "$2" "$3" oct. byte, u03B1 „ “ (U+03B1) in UTF-8 • Previous/next command in Ctrl+p / Ctrl+n • • \ dd if=in of=out bs=k count=n – read blocks of bytes jC / kC $_ – last