![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| cut - columns with formatted Output | dhanamurthy | Shell Programming and Scripting | 9 | 05-19-2008 11:20 AM |
| Formatted Output | dhanamurthy | Shell Programming and Scripting | 6 | 05-13-2008 03:30 AM |
| Formatted output - awk | dhanamurthy | Shell Programming and Scripting | 3 | 05-12-2008 12:25 AM |
| formatted output with commas | joeyg | Shell Programming and Scripting | 4 | 03-04-2008 03:54 PM |
| Formatted output in KSH | psynaps3 | Shell Programming and Scripting | 1 | 07-05-2006 09:03 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
mailing customized and formatted ls -lt command output
I'm trying to write a script to email the output of 'ls -lt' command that are 30 days old along with headers for eg. like owner, date, timestamp and a portion of some special character files like 'slfpay$/#:032508AA' in /home/test directory, I just want the numbers from the last field ($9), also the email I get contains the 1st line of ls -lt output along with subject and remaining output in the message body whereas the complete output should go to a message body.
# ls -lt rwxr-xr-x 1 tik44 staff 7731 Oct 09 17:15 bma slfpay$/#:032508AA rwxr-xr-x 1 tik77 staff 6701 Sep 13 09:47 bma slfpay$/#:054101AA Output should look like, Owner Date Timestamp FileName tik44 Oct 09 17:15 032508 tik47 Sep 13 09:47 054321 ----------Script-------------------------------- #!/usr/bin/ksh set -x DIR=/home/test OLD=$(find $DIR -mtime +30 -exec ls {} \ -->this is ; and ) not smileyif [ ! -z "$OLD" ]; then LS=`ls -lt $DIR | ls -lt | awk '{print $3 " " $6 " " $7 " " $8 " " $9}' echo |mail -s "`hostname`: Output from ls -l command" \ "user@test.com user1@test1.com" ----------Script-------------------------------- Thanks |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|