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
file comparison script tiger99 Shell Programming and Scripting 1 01-30-2008 10:47 AM
Problem in ksh script ( String comparison ) amarnath AIX 1 07-18-2006 06:40 AM
Problem in ksh script ( String comparison ) amarnath Shell Programming and Scripting 3 07-13-2006 12:14 PM
Help with time comparison shell script for HP-UX gummysweets Shell Programming and Scripting 6 10-12-2005 10:48 AM
Installing Patches from a script viRaven Shell Programming and Scripting 3 12-12-2003 12:52 PM

Closed Thread
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
  #1 (permalink)  
Old 03-18-2009
Sathvik Sathvik is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 1
Comparison of 2 sun server patches using script

Hi,

I am not sure what I am missing, tried to debug but was not successful, any help on this will be much appreciated.

Code:
#!/bin/sh
rm -f /tmp/t?
host1=`cat $1|grep Hostname: | awk '{print $2}'`
host2=`cat $2|grep Hostname: | awk '{print $2}'`
rel1=`cat $1|grep Release: | awk '{print $2}'`
rel2=`cat $2|grep Release: | awk '{print $2}'`
arch1=`cat $1|grep "Kernel architecture:" | awk '{print $3}'`
arch2=`cat $2|grep "Kernel architecture:" | awk '{print $3}'`

cat $1 |grep "Patch:" | awk '{print $2}'  >/tmp/t1
cat $2 |grep "Patch:" | awk '{print $2}'  >/tmp/t2

cat /tmp/t1 | awk '{print $1}'| sort  >/tmp/t3
cat /tmp/t2 | awk '{print $1}'| sort  >/tmp/t4

prev=`head -1 t3`
for  i in `cat t3`
do
        curr=$i
        if [ $prev != $curr ]
        then
                currhead=`echo $curr | cut -f 1 -d "-"`
                prevhead=`echo $prev | cut -f 1 -d "-"`
                if [ $prevhead != $currhead ]
                then
                        echo $prev >> /tmp/ta
                fi
                prev=$curr
        fi
done

rm /tmp/t?
When I execute this I get the following output, and stucks there itself.

$ ./patchscript
+ rm -f /tmp/t?
+ cat
+ grep Hostname:
+ awk {print $2}

Last edited by DukeNuke2; 03-21-2009 at 12:53 PM..
  #2 (permalink)  
Old 03-21-2009
radoulov's Avatar
radoulov radoulov is offline Forum Staff  
addict
  
 

Join Date: Jan 2007
Location: Варна, България / Milano, Italia
Posts: 2,860
Please post the content of the two input files ($1 and $2) and explain what you want to achieve.
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 07:43 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