Or use equality (==) instead of pattern matching (~). The ~ operator will match the pattern anywhere in the field.
aju_kup's solution to use a better pattern is of course a perfectly good solution as well; just pointing out an alternative which may be more convenient in some situations.
I found below script to check whether the variable is a digit in ksh.
############################
#!/bin/ksh
REPLY="3f"
if ]*\)'` != ${REPLY} && "${REPLY}" != "0" ]]
then
print "is digit\n"
else
print "not digit\n"
fi
############################
Although it works fine, but... (6 Replies)
Folks,
Is there a simple way to replace one digit by two digit using sed.
Example,
mydigit1918_2006_8_8_lag1.csv should be
mydigit1918_2006_08_08_lag01.csv.
I tried this way, but doesn't work.
echo mydigit1989_2006_8_8_lag1.csv|sed 's/]/0]/'
Thank you, (5 Replies)
I have a var storing date
var=`date`
Now the date is returned as
Mon Feb 2 00:25:48 PST 2009
Is there any way to check the date field alone ("2" in above case) and if its a single digit then add a prefix 0 to it and store the result in same variable "var"
My intention in above case is... (3 Replies)
I have to write a c program which takes a 3 digit number n and calculates the value of (2^n)+1 and then determines the number is prime or not.
I have tried to first calculate the value of 2^n and then adding one to it and then apply the logic of prime number.
but the ultimate problem is that... (7 Replies)
Hi,
Does anybody know what the below means:
I have a program containing the following and am trying to understand what it does:
temp=$(echo $count2 | tr -cd )
Cheers
Paul
Please start using code tags (2 Replies)
Hi all,
Need your help here. I have a file with thousand of lines, as shown in example below
KDKJAA 98324
OIDSAJ 324
KJAJAK 100
KJKAJK 89
JOIJOI 21
JDKDJL 12
UOIUOD 10
UDUYDS 8
UIUHKK 6
I would like to grep using... (5 Replies)
Thanks of your suggestions i was able to calculate the delta between some numbers in a column file with .
awk 'BEGIN{last=0}{delta=$1-last; last=$1; print $0" "delta}'
the file was like
499849120.00
500201312.00
500352416.00
500402784.00
500150944.00
499849120.00
500150944.00... (3 Replies)
Discussion started by: Board27
3 Replies
LEARN ABOUT HPUX
evmeventnamematch
EvmEventNameMatch(3) Library Functions Manual EvmEventNameMatch(3)NAME
EvmEventNameMatch(), EvmEventNameMatchStr() - match EVM event name
SYNOPSIS
Library
EVM Support Library
Parameters
pattern The event name pattern sought. The pattern may be any valid event name string. It may include wildcard characters in place
of any component.
event The event containing the event name to be compared against the pattern.
match The result of the match. This operand is set to if the name matches the pattern, and to if it does not.
candidate A character string to be matched against the pattern
DESCRIPTION
Because special matching rules apply when deciding whether a candidate event name matches a known name, the EVM name matching functions
should be used for matching purposes, rather than the C string comparison functions The EVM functions match an event name against a sup-
plied pattern, ignoring any trailing appended components in the candidate name, and correctly matching wildcard characters.
The function takes an event and an event name pattern as input, and returns an indication of whether the event contains a name which
matches the pattern in the match output argument. The pattern may be any valid event name string, and may also include wildcard characters
in place of any component. A wildcard in the pattern matches zero or more name components. A matches exactly one component. A match
occurs if the event name matches all components indicated by the pattern, even if the name has additional trailing elements.
The function performs the same check as but takes a character string as the candidate event name, instead of extracting the candidate event
name from a supplied event.
Both functions set the match output argument to if the name matches the pattern, and to if it does not.
RETURN VALUE
The operation completed without error. The comparison was successful. The value of the match operand indicates whether the name matches
the pattern.
One of the arguments to the function is invalid.
The supplied pattern contains invalid characters.
The supplied event does not contain a name.
ERRORS
The value of is not set.
SEE ALSO
Routines
memccpy(3C), strcat(3C).
Event Management
EVM(5).
EVM Events
EvmEvent(5).
EvmEventNameMatch(3)