-   Linux - General (
-   -   How to use Cut (

ZAMO 09-25-2008 02:31 AM

How to use Cut
Hi all,

Am trying to cut the kilobytes(K) or Megabytes(M) from the following. But am unable to get the help from man page of cut.


ls -lht myfile |awk '{print $5}' |cut ???

Say if the file size 12M , then I want to truncate the "M" from it and need only 12.


ghostdog74 09-25-2008 02:34 AM


ls -lht 9115.THM | awk '{print $5+0}'

ZAMO 09-25-2008 03:13 AM

Thanks a lot :)

Cheers to become the Senior Member Soon :)

trickykid 09-25-2008 12:39 PM

cut is like awk but is only the basic portion of it. It only cuts or removes from each line in a file or output. In this case, you could have used cut to grab the size but cut can't eliminate the M, otherwords, it can't really manipulate the output in anyway.

Use cut if you don't need to manipulate the output, use awk if you do. That's how I approach these two commands.

All times are GMT -5. The time now is 12:03 PM.