ls -1 | cpio -o | cpio -ivt | awk ‘{print $NF, $(NF-1), $(NF-4), $(NF-3) }’
Warning: I/O expensive for the large files!
Perl:
@a = localtime((stat($my_file))[9]); [...]
|
||||||||
|
ls -1 | cpio -o | cpio -ivt | awk ‘{print $NF, $(NF-1), $(NF-4), $(NF-3) }’ Warning: I/O expensive for the large files! Perl: @a = localtime((stat($my_file))[9]); [...] If the whole output of the complex script should be redirected to the log, the following trick could be used. if [ "$1" != "-log" ] ; then Here is very simple trick to force the grep command to display file name, when it’s used together with find operation. find . -type f -exec grep somestring {} [...] Here is the small reminder about the syntax of the “case” command and the usage of the pattern lists. #!/bin/ksh case "$line" in echo $PATH| awk -v RS=":" ‘{ print $0 }’ echo $LD_LIBRARY_PATH |awk -v RS=":" ‘{ system ( "ls -rltd " $0 ) }’ Warning! To check if the new version of awk is installed: awk 1 /dev/null The output will be empty for new awk. Quick and dirty parsing procedure for unix shell scripts parse_command_line () arg_cou=$# while [ "$#" -gt 0 ] 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: Rev in awk #!/bin/ksh Rev function (absent on SunOS) : (Warning! [...] |
||||||||
|
Copyright © 2010 MemoSoup - All Rights Reserved
|
||||||||