![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
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 |
|
||||
|
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 | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|