02-25-2003
Copy your if statment and then edit it so that a line like this:
if [[ $first = '*** Testing file' ]] &&
becomes like this:
Xfirst='*** Testing file'
and do that for Xsecond and Xfirst as well. Make very sure that the constant is exactly the same as in the if statement. Put the new lines in front of the if statement. And after them put 6 lines like this:
echo the length of first is ${#first}
echo the length of Xfirst is ${Xfirst}
and so on with the other 4. This will show you how long the variables are. And how long the constants are. Something has got to be off.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
Is there any limitation on the no of characters to be compared using the if statement in Unix. We had an issue while comparing the following two nos.
var1=20051031222900 & var2=20051101003545. The last six dgits are the time stamp for a day.
The if statement is like this:
if
then
move... (8 Replies)
Discussion started by: ranj@chn
8 Replies
2. Shell Programming and Scripting
hi ,
i am trying to compre two strings
if ] or if ]
when the length of var1 is small (around 300-400 char ) it works fine
but when it is large (around 900-1000 chars) it fails
is there any limitations for this type of comparison ??? (3 Replies)
Discussion started by: amarnath
3 Replies
3. AIX
hi ,
i am trying to compre two strings
if ] or if ]
when the length of var1 is small (around 300-400 char ) it works fine
but when it is large (around 900-1000 chars) it fails
is there any limitations for this type of comparison ??? (1 Reply)
Discussion started by: amarnath
1 Replies
4. Shell Programming and Scripting
Hello,
was just wondering how to compare strings in unix? I mean as in C there is a function strcmp() in string.h, is there any function in unix for that? I tried using
if
and all such variations but didn't succeed. Any help would be appreciated. Thanks in advance :) (9 Replies)
Discussion started by: salman4u
9 Replies
5. Shell Programming and Scripting
Another frustrating scripting problem from a biologist trying to manipulate a file with several millions line. For each of the line I need to compare the uppercase A or C or G or T with the lowercase a or c or g or t. If there are more uppercases, a + should be added to a new column, otherwise a -... (10 Replies)
Discussion started by: ivpz
10 Replies
6. UNIX for Dummies Questions & Answers
This might be a dummy question, but is there a command in UNIX that compare two strings character-by-character and display the difference?
---------- Post updated at 11:25 AM ---------- Previous update was at 10:32 AM ----------
Or probably what I'm looking is how to break a string into... (3 Replies)
Discussion started by: Orbix
3 Replies
7. Shell Programming and Scripting
Hi,
can someone please help me!!! urgent!
I have a strange issue here. I grep for 2 strings from a txt files and compare the string value. Though the string values are the same, they are compared as different values. Please help
Case-1
--------
Here I grep for 2 different field values... (3 Replies)
Discussion started by: vani123
3 Replies
8. Shell Programming and Scripting
Hi friend,
i have the following problem:
when i am writting the below command on the command prompt , its working.
while read -n 1 ch; do echo "$ch" ; echo "$ch" ; done<file_name.out.
but when i am executing it after saving it in a ksh file, its not working.
Please helppppppppp .. thankss... (18 Replies)
Discussion started by: neelmani
18 Replies
9. Shell Programming and Scripting
Hi,
I've tried searching through the forum but I've drawn a blank so i'm going to post here. I'm developing a number of checks on a CSV file, trying to find if any are greater than a max limit. I'm testing it by running it from a command line.
The file I'm testing has 8 records. When I... (3 Replies)
Discussion started by: Tmart
3 Replies
10. Shell Programming and Scripting
guys , i am using inotify for monitoring one directory to check core file generation , my snippet of code is follows
#!/bin/bash
DIR=$1
inotifywait -q -e create -m $DIR | while read path events name;
do
if ]; then
echo "Now I am going to do something with $name in directory $path."... (5 Replies)
Discussion started by: baker
5 Replies