The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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
Changing one column of delimited file column to fixed width column manneni prakash Shell Programming and Scripting 5 06-22-2009 06:27 AM
Adding a column to a text based on file name rlapate Shell Programming and Scripting 12 05-23-2009 10:22 PM
Adding a new column in a text file snahata Shell Programming and Scripting 10 03-13-2009 07:00 AM
FILE:Adding new column sandeep_hi Shell Programming and Scripting 2 06-09-2006 10:46 AM
Changing the column for a row in a text file and adding another row aYankeeFan Shell Programming and Scripting 9 05-02-2005 10:42 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 08-27-2009
EAGL€ EAGL€ is offline
Registered User
  
 

Join Date: Aug 2009
Location: istanbul
Posts: 42
awk-adding a column to a file

Hello Friends,

i used awk to sum up total size of files under a directory (with the help of examples, threads here).


Code:
ls -l | awk '/^-/ {total += $5} END {printf "%15.0f\n",total}' >> total.txt

After each execution of the script total result is appended into a text file:

Code:
7010
7794
8890

i would like to add the execution date of the script into first column and then the results to the second column, but i couldnt do it after some tries. Do you know how to modify the script to add the date (date format is not important)?

expected:

Code:
Aug 27 7010
Sep 27 7794
Oct 27 8890



thanks by advance
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:49 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0