![]() |
|
|
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 |
| how to modify ramdisk size,kinda urgent !!! | wrapster | Shell Programming and Scripting | 1 | 04-11-2008 04:16 AM |
| how to modify font size and type from script | helido | UNIX for Advanced & Expert Users | 3 | 02-08-2008 10:19 AM |
| Looking for a string in files and reporting matches | btrotter | Shell Programming and Scripting | 4 | 03-29-2007 10:00 PM |
| Modify the size of parttion under solaris | toufik | SUN Solaris | 1 | 06-27-2006 12:52 PM |
| Comparing two files and noting matches | augustinep | UNIX for Dummies Questions & Answers | 2 | 11-20-2001 02:33 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
looking for files and modify if size matches
hi there.
I'm at SunOS 5.9 At my new job i'm using UNIX, and it's my first time. i'm trying to make a script for: -find files with a name passed to it as parameter -compare results with file size passed as parameter too -when comparison's true --> move file -if not--> make nothing well, i'll have prevent too similer name-size files. but i can solve that later. my trouble now is in spliting string with awk. i can't understand why it doesn't work name=`find $CLL_DAT -name "$1*" -print`; lines=`awk 'END { print NR }' $name` echo "$lines"; if [ "$lines" = "$2" ]; then echo "here i'll do what i have"; else echo "ERROR $name"; fi this is working, but i need to expand string catched by find, into 'n' strings, and make things for all of them. name=`find $CLL_DAT -name "$1*" -print`; awk '{n=split($name,names," ")}'#########################i don't know how to make work this split function flag=0 for (( i = 0 ; i <= n; i++ )) do lines=`awk '{END { print NR }}' ${names[$i]}` echo "$lines" if [ "$lines" = "$2" ]; then if ["$flag" = 1]; then echo 'two files matches' exit fi flag=1 name=${names[$i]} echo 'matches' else echo "don't matches" fi done |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|