The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
sed query gopsman Shell Programming and Scripting 4 02-03-2009 02:41 AM
& in SQL query Lindarella Shell Programming and Scripting 3 10-09-2006 04:43 PM
Query In awk raguramtgr UNIX for Dummies Questions & Answers 1 08-27-2004 11:00 AM
RPM Query silvaman UNIX for Advanced & Expert Users 1 08-15-2003 07:56 AM

 
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 01-02-2008
Amey Joshi Amey Joshi is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 50
Post some query in awk

Hi ,
I want to assign a value to variable which will have size of the file that is
we have following files for eg:
ls -ltr
-rw-rw-r-- 1 dsadmin dstage 34 Oct 29 12:14 some.txt
-rw-rw-r-- 1 dsadmin dstage 0 Oct 29 14:52 eg.txt
-rwxrwxr-x 1 dsadmin dstage 1453 Oct 30 08:07 time1.sh
-rw-rw-r-- 1 dsadmin dstage 197 Oct 30 08:13 start.txt
-rwxrwxr-x 1 dsadmin dstage 1389 Oct 30 09:26 time.sh
-rwxrwxr-x 1 dsadmin dstage 311 Nov 12 15:23 timeone.sh
-rwxrwxr-x 1 dsadmin dstage 123 Nov 26 09:48 som1.sh

sizes are marked in bold.Now if i use the following command
size=`ls -ltr | awk '{printf $5}'`
it is giving me out put as
size=34014531971389311123
But my requirement is
size=34
size=0 and so on...

Can anybody help me out since i am new to unix..
Thanks in 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 09:29 PM.


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