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 > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Unix shell script for finding top ten files of maximum size abhilashnair UNIX for Dummies Questions & Answers 10 02-18-2008 01:50 AM
shell script to find files by date and size dadadc UNIX for Dummies Questions & Answers 1 10-20-2007 05:18 AM
size of files shary Shell Programming and Scripting 1 02-17-2007 12:06 PM
Files list which are more than 300 MB size redlotus72 UNIX for Dummies Questions & Answers 2 09-14-2006 12:28 AM
calculate size of some files big123456 Shell Programming and Scripting 11 07-22-2005 05:07 PM

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

Join Date: Oct 2006
Posts: 4
bash script working for small size files but not for big size files.

Hi,

I have one file stat.

Stat file contents are as follows: for example.
H50768020040913,00260100,507680,13,0000000643,0000000643,00000,0000
H50769520040808,00260100,507695,13,0000000000,0000000000,00000,0000 H50770620040611,00260100,507706,13,0000000000,0000000000,00000,0000

Now i have to get the date from that stat file and based on the date i have to do some deletion on the data.

Shell Script has been written for this, and it works fine. The script is attached below.

a=`cat $1`
IFS=' '
set `date`
m=$2
case $m in
jan*|Jan*) m=1 ;;
feb*|Feb*) m=2 ;;
mar*|Mar*) m=3 ;;
apr*|Apr*) m=4 ;;
may*|May*) m=5 ;;
jun*|Jun*) m=6 ;;
jul*|Jul*) m=7 ;;
aug*|Aug*) m=8 ;;
sep*|Sep*) m=9 ;;
oct*|Oct*) m=10 ;;
nov*|Nov*) m=11 ;;
dec*|Dec*) m=12 ;;
esac
v=$6$m
if test $m = 12
then
m=`expr $m - 2`
else
m=`expr $m - 2`
m=0$m
fi
s=01
v=$6$m$s
echo hai
set $a
IFS=' '
for i in $*
do
q=$i
IFS=','
set $i
set recval = `echo $1 | awk '{print substr($0,8,8)}'`
w=$3
if test $w -gt $v
then
echo $q >>cc.txt
fi
done

This is working fine for small size files (stat file).
If i run this script for big size files, then i get error as 'argument expected'

Please help me on this.

Thanks
David
  #2 (permalink)  
Old 11-01-2006
Corona688 Corona688 is offline
Registered User
  
 

Join Date: Aug 2005
Location: Saskatchewan
Posts: 1,909
code tags for code please. It makes code readable. Like {code} stuff {/code} except with [ ] instead of { }.

I take it $1 is the stat file? What is the a=`cat $1` bit for? $a isn't even used anywhere else.

If $a is used anywhere else, this'd be the weak point. Shell variables have size limits. Use pipes instead.
Sponsored Links
Closed Thread

Bookmarks

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



All times are GMT -4. The time now is 09:10 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
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