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 > Operating Systems > 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-15-2008 12:34 AM
Please respond immediately deepti.1104 Shell Programming and Scripting 3 08-31-2007 02:01 AM
I need help immediately. Please help me Sheethal UNIX for Dummies Questions & Answers 4 07-26-2007 06:11 AM
UIDs being overwritten immediately xsys2000 AIX 2 05-08-2007 01:00 PM
Need a Shell Program immediately praji Shell Programming and Scripting 4 01-22-2002 04:09 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-01-2007
infyanurag infyanurag is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 65
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
  #2 (permalink)  
Old 11-01-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
Can you explain the scenario and what you want to redirect?
  #3 (permalink)  
Old 11-01-2007
Yogesh Sawant's Avatar
Yogesh Sawant Yogesh Sawant is offline Forum Staff  
Part Time Moderator and Full Time Dad
  
 

Join Date: Sep 2006
Location: Rossem, Tazenda
Posts: 1,086
this will help you to get size of the file:
Code:
ls -l filename | awk '{print $5}'
  #4 (permalink)  
Old 11-01-2007
sysgate's Avatar
sysgate sysgate is offline Forum Advisor  
Unix based
  
 

Join Date: Nov 2006
Location: Bulgaria
Posts: 1,318
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.
  #5 (permalink)  
Old 11-02-2007
mr_manny mr_manny is offline
Registered User
  
 

Join Date: Oct 2005
Posts: 144
I believe you need to use a "+" in front of the 5M...otherwise it will only look for files exactly 5MB.
Closed Thread

Bookmarks

Tags
awk

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:25 AM.


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