|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | 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. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
value compare
Hi, file contains only one row. Code:
END OF FILE. ROW COUNT: 8,9 We need to check the file contains exact string "END OF FILE. ROW COUNT: " if yes, get the 8,9 values then compare if both are equal print the "equal" if not "notequal". Thanks, |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
Code:
awk -F"[ ,]" '/END OF FILE/{print $NF != $(NF-1)?"notequal":"equal"}' file |
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
Thanks,as per validation it should come equal,it coming as "notequal",but i need implement the in script,if equal got to one step else another step...
Please help me |
|
#4
|
||||
|
||||
|
Something like this? Code:
sed -n 's|^END OF FILE. ROW COUNT: \([0-9]\{1,\}\),\([0-9]\{1,\}\)|\1 \2|p' <filename>|read num1 num2
if [ ! -z "$num1" -a ! -z "$num2" ]
then
if [ $num1 -eq $num2 ]
then
echo Equal
else
echo Not equal
fi
fi |
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
Thanks lot working fine...
|
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Require compare command to compare 4 files | nehashine | Shell Programming and Scripting | 6 | 08-27-2010 07:29 AM |
| Compare | kezkez | Shell Programming and Scripting | 1 | 07-13-2010 08:01 PM |
| Compare two arrays in sh or compare two fields | rijeshpp | Shell Programming and Scripting | 0 | 10-31-2007 02:47 AM |
| compare two tar.bz2 | JCR | Shell Programming and Scripting | 2 | 07-30-2007 11:16 AM |
| How to compare it ?? | sabercats | Shell Programming and Scripting | 4 | 02-16-2006 05:07 PM |
|
|