If the whole output of the complex script should be redirected to the log, the following trick could be used.
if [ "$1" != "-log" ] ; then $0 -log "$@" 2>&1 | tee the_log_file.$$.log
echo "The log file for the current session: the_log_file.$$.log"
exit 0
fi
shift # remove "-log" parameter
news and informations automotive,business,crime,health,life,politics,science,technology,travelautomotive,business,crime,health,life,politics,science,technology,travel
echo $PATH| awk -v RS=":" ‘{ print $0 }’ echo $LD_LIBRARY_PATH |awk -v RS=":" ‘{ system ( "ls -rltd " $0 ) }’
Warning! As far as the option ‘-v’ is used, the new awk(nawk in some systems) should be used.
To check if the new version of awk is installed:
awk 1 /dev/null
The [...]
news and informations automotive,business,crime,health,life,politics,science,technology,travelautomotive,business,crime,health,life,politics,science,technology,travel
Only the short info about Sybase database devices. Parameters: min_space – minimum of required space (i.e. 40 will display the devices with >=40M free space) the_name – the template for the device name (i.e. %mast% will display only master device)
Warning! It was not tested for all possible configurations, so the result could be incorrect [...]
news and informations automotive,business,crime,health,life,politics,science,technology,travelautomotive,business,crime,health,life,politics,science,technology,travel
Here is the shell command snippet to display comma-separated output:
ls -lrt | rev | sed ‘s/\\([0-9][0-9][0-9]\\)/\\1,/g’ | rev | sed ‘s/\\([\^0-9]\\),\\([0-9]\\)/\\1\\2/g;s/\^,\\([0-9]\\)/\\1/g’
Example: -rw-r—– 1 sybase dba 1,572,872,192 Feb 2 07:09 master.dbf
Rev in awk
#!/bin/ksh nawk ‘{ l=length($0) ; for(i=l;i>0;i–) { printf "%s", substr($0,i,1) } ; print "" }’
Rev function (absent on SunOS) [...]
news and informations automotive,business,crime,health,life,politics,science,technology,travelautomotive,business,crime,health,life,politics,science,technology,travel
|
|