The UNIX and Linux Forums  


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
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

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 02-15-2008
viko viko is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 13
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
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 01:25 PM.


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