![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
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 |
|
||||
|
an example :
ls -ltr | awk '{print $5}' | while read size do echo "size is $size" done |
| Sponsored Links | ||
|
|