The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > Linux
Google UNIX.COM


Linux RedHat, Ubuntu, SUSE, Fedora, Debian, Mandriva, Slackware, Gentoo linux, PCLinuxOS. All Linux questions here!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to delete line with matching text and line immediately after orahi001 UNIX for Dummies Questions & Answers 6 01-14-2008 09:34 PM
Please respond immediately deepti.1104 Shell Programming and Scripting 3 08-30-2007 11:01 PM
I need help immediately. Please help me Sheethal UNIX for Dummies Questions & Answers 4 07-26-2007 03:11 AM
UIDs being overwritten immediately xsys2000 AIX 2 05-08-2007 10:00 AM
Need a Shell Program immediately praji Shell Programming and Scripting 4 01-22-2002 01:09 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 11-01-2007
Registered User
 

Join Date: Nov 2007
Posts: 55
please help immediately

how can i check if the size of my file is greater than 5MB and if it is so then how can I direct my data to another new file.
the data will be in the form of SQL query
Reply With Quote
Forum Sponsor
  #2  
Old 11-01-2007
Registered User
 

Join Date: Jan 2007
Posts: 2,965
Can you explain the scenario and what you want to redirect?
Reply With Quote
  #3  
Old 11-01-2007
Yogesh Sawant's Avatar
Part Time Moderator and Full Time Dad
 

Join Date: Sep 2006
Location: Rossem, Tazenda
Posts: 790
this will help you to get size of the file:
Code:
ls -l filename | awk '{print $5}'
Reply With Quote
  #4  
Old 11-01-2007
sysgate's Avatar
Unix based
 

Join Date: Nov 2006
Location: /root
Posts: 1,197
From man find :
Quote:
-size n[cwbkMG]
File uses n units of space. The following suffixes can be used:

‘b’ for 512-byte blocks (this is the default if no suffix is used)

‘c’ for bytes

‘w’ for two-byte words

‘k’ for Kilobytes (units of 1024 bytes)

‘M’ for Megabytes (units of 1048576 bytes)

‘G’ for Gigabytes (units of 1073741824 bytes)
use find, determine if the file is greater than 5MB and then eventaully copy this file to another, with a different name. HTH, if I got it correctly.
Reply With Quote
  #5  
Old 11-02-2007
Registered User
 

Join Date: Oct 2005
Posts: 135
I believe you need to use a "+" in front of the 5M...otherwise it will only look for files exactly 5MB.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
awk

Thread Tools
Display Modes




All times are GMT -7. The time now is 08:15 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0