RSS feed [root] /unix /weblog /script



title search:


Sun Aug 06 19:21:16 AEST 2017


(google search) (amazon search)
download zip of files only

Sun Aug 06 19:21:16 AEST 2017 From /weblog/unix/script


10 awk tips -

8 Powerful Awk Built-in Variables – FS, OFS, RS, ORS, NR, NF, FILENAME, FNR -[..]iables-fs-ofs-rs-ors-nr-nf-filename-fnr/

Tutorial of text editing commands -[..]works/aix/library/au-unixtext/index.html

wc and nl tutorial -

tips for uniq, like show only items have duplications -

Tips of "cat", include display by column and by delimiter -

Using lynx to convert HTML to text -

(google search) (amazon search)

Sun Aug 06 19:20:16 AEST 2017 From /weblog/unix/script


Various ways to working with file -

Use truncate to pad the file size up -

Making a file unalterable with chattr -

(google search) (amazon search)

Wed Jun 14 20:34:19 AEST 2017 From /weblog/unix/script


A bash debugger -

Really really good tips -[..]3/10/shell-scripting-best-practices.html

Style guide -[..]og/2012/11/14/defensive-bash-programming

Script checker -

How to write a shell -

(google search) (amazon search)

Fri Apr 01 14:29:26 AEDT 2016 From /weblog/unix/script


How to use eval, hash, readonly, shift, getopts, set, unset, let and shopt -

Sample bash completion

SSH_COMPLETE=( $(cut -f1 -d' ' ~/.ssh/known_hosts |\
tr ',' '\n' |\
sort -u |\
grep -e '[:alpha:]') )
complete -o default -W "${SSH_COMPLETE[*]}" ssh

Check history statistic - brianm@binky:~$ history | awk {'print $2'} | sort | uniq -c | sort -k1 -rn | head
164 svn
52 cd
42 ssh
32 sudo
22 git
16 ls
16 for
14 echo
13 man
10 curl

easy way to do "[-h|--help][-n|--name ]" -

(google search) (amazon search)

Thu Feb 04 00:57:47 AEDT 2016 From /weblog/unix/script


An question about how to remove unused package from MacOSX turn out to be an example of "find" command:[..]find-command-in-unix-examples-basic.html

File Search tips in Linux -[..]iscussTopicParent=18272&ixDiscussGroup=3

Another search tip, example of find base on time and size, and how to compare with other files -[..]e-useful-unix-file-finding-commands.html

Like search by name, depth, size -[..]5-practical-linux-find-command-examples/

use 'find' to delete branch of file:

By time -[..]unix-linux-find-command-examples-part-2/

Use of empty -[..]010/03/find-empty-directories-and-files/

(google search) (amazon search)

Thu Feb 04 00:55:53 AEDT 2016 From /weblog/unix/script


(google search) (amazon search)

Fri Mar 01 12:25:37 AEDT 2013 From /weblog/unix/script


Convert PDF to set of image as slide show -

pdftk, extra pages from one pdf to another pdf -[..]2/splitting-up-is-easy-for-pdf-file.html

(google search) (amazon search)

Sun Dec 23 03:56:52 AEDT 2012 From /weblog/unix/script


tr, useful string tranformation tool -

(google search) (amazon search)

Wed Jan 25 03:42:37 AEDT 2012 From /weblog/unix/script


Simulate user input -

(google search) (amazon search)

Sat Sep 03 13:37:14 AEST 2011 From /weblog/unix/script


Sort by column -[..]/unix-sort-command-example-tutorial.html

(google search) (amazon search)

Thu Aug 25 04:16:44 AEST 2011 From /weblog/unix/script


Create webserver with nc using bash[..]07/09/06/web-server-on-bash-in-one-line/

(google search) (amazon search)

Tue Jul 12 03:11:20 AEST 2011 From /weblog/unix/script


(google search) (amazon search)

Fri Jul 08 01:54:28 AEST 2011 From /weblog/unix/script

useful example of shell script

xmlwf, need to know if a XML document is well formed? (A configuration file maybe..)
mkfifo is the coolest one. Sure you know how to create a pipeline piping the output of grep to less or maybe even perl.
nl, add number for every line of a file[..]/10-linux-commands-youve-never-used.html

======================================create real player song list
for file in `find $1 -type f`;
if(`/bin/cat $file | grep $win_path`); then echo $file;fi;
/usr/bin/find $MUSIC_SRC -type f -exec /bin/echo file://{} \; > $TMPDIR/tmp.rm
while read i ; do /bin/echo "$RANDOM $i" ; done < $TMPDIR/tmp.rm | /bin/sort -n | /bin/sed 's/^[0-9]* //' > $TMPDIR/tmp1.rm
/bin/cat $TMPDIR/tmp1.rm |/bin/sed -e 's/file:\/\///' >$HOME/mplayer.list
/bin/cat $TMPDIR/tmp1.rm |/bin/grep -vi wma >$HOME/real.rm
/bin/cat $TMPDIR/tmp1.rm |/bin/sed -e 's/file:\/\/\/var\/www\/html/http:\/\/'>/var/www/html/.secure/media/music/live.rm

======================================remove log
for file in `find -type f|grep website.|grep -v lck`;do rm -f $file;done
======================================for loop
for((a = 1; a <10; a++)); do wget -b "$a.jpg";done
======================================resize photo
for i in *.jpg; do convert -geometry 1024x768 $i newdir/$i ; done
======================================basic calculation
i=1;find|grep -v zng|grep -v avi|while read file;do mv "$file" $i.jpg;i=$((i+1));done
======================================# Make 3 a copy of 1 (stdout)
exec 3>&1
result="$(command to generate stream \
| tee /dev/fd/3 \
| command to process stream)"
# Now work with $result
# The original stream also went to the console[..]5/getting-more-from-streams-in-bash.html

(google search) (amazon search)

Wed Feb 11 21:55:55 AEDT 2009 From /weblog/unix/script


hint of using test -

(google search) (amazon search)

Thu May 08 16:00:20 AEST 2008 From /weblog/unix/script


A working date calculation script[..]s/4870-days-elapsed-between-2-dates.html

(google search) (amazon search)

Fri Jun 16 23:37:41 AEST 2006 From /weblog/unix/script

check exit status

Need to check #? and PIPESTATUS

(google search) (amazon search)

Sun May 28 20:31:46 AEST 2006 From /weblog/unix/script

Batch rename

Script of batch rename at unix system

(google search) (amazon search)

Tue Nov 08 17:33:09 AEDT 2005 From /weblog/unix/script

Unix KornShell Quick Reference

(google search) (amazon search)

Tue Oct 04 13:58:05 AEST 2005 From /weblog/unix/script

safer rm

A number of tips to make rm command safer[..]le.php?story=20050928082624470&lsrc=osxh

(google search) (amazon search)