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. Code:
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. Thanks |
Code:
ls -lht 9115.THM | awk '{print $5+0}' |
Thanks a lot :)
Cheers to become the Senior Member Soon :) |
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 03:49 PM. |