Hi folksSorry if code tags don't work out correctly but this PC does not have Java setup correctly to allow me to put them inproperly.I have a simple string pattern match behaving differntly on AIX and Solaris 10 and I don't understand why or what to do about it.This simple test: -
echos yes on Solaris but not on AIX. To my mind I would expect this to fail on both as the string begins with a lower case i. This does not seem to happen on Solaris 8I am simply trying to confirm that the string begins with an uppercase letter but cannot seem to nail down a pattern that works on both OS'sAny ideas?
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 2,288
Thanks Given: 430
Thanked 480 Times in 395 Posts
Hi.
It's not usually the OS that is the issue in cases like this, but rather the shell. Here is a similar test:
producing:
and I think you were looking for a failure -- which I called "KO" in this script.
What shells are you using in both OSs? ... cheers, drl
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 2,288
Thanks Given: 430
Thanked 480 Times in 395 Posts
Hi.
I don't know why that would be the case. This style of test is by default an anchored match, meaning that the pattern must account for all characters from first through last. Sometimes that might require a "*" at one or both ends.
Here is a more complete test, using the original expression, the new one you found that worked, and a bashism that allows "normal" regular expression syntax. I then ran it with the 3 common shells, ksh, bash, zsh:
producing for ksh:
with bash:
with zsh:
This all worked as I expected. I noted earlier that it worked as expected on Solaris / ksh 88i.
I also ran it with pdksh, with the first tests running as expected (it does not have the machinery to process "=~", apparently) ... cheers, drl
On investigation I found that on the solaris 10 boxes, (all servers / OS's were running ksh 88) LC_ALL was unset on login.
Setting it to LC_ALL=C ksh made the test behave as you would expect, while unsetting it gave the unexpected behaviour when expanding the range A-Z. Interestingly the range 0-9 worked perfectly, didn't think to try the range a-z, maybe tomorrow when I go back to work.
I am trying to see what impact this may have on our toolset, as we don't want to adversly impact the applications we are monitoring.
Hello Experts , require help . See below output:
File inputs
------------------------------------------
Server Host = mike
id rl images allocated last updated density
vimages expiration last read <------- STATUS ------->... (4 Replies)
Im using the command below , but thats not the output that i want. it only prints the odd and even numbers.
awk '{if(NR%2){print $0 > "1"}else{print $0 > "2"}}'
Im hoping for something like this
file1:
Text hi this is just a test
text1 text2 text3 text4 text5 text6
Text hi... (2 Replies)
Ive used this snippet of code on a solaris box thousands of times.
But it isnt working on the new linux box
sed -n '/interface LoopBack0/{N;/ ip address /p;}' *.conf
its driving me nuts !!
Is there something Im missing ? (7 Replies)
I have an application(Minecraft Server) that generates a logfile live. Using Crontab and screen I send a 'list' command every minute.
Sample Log view:
2013-06-07 19:14:37 <Willrocksyea1> hello*
2013-06-07 19:14:41 <Gromden29> hey
2013-06-07 19:14:42 Gromden29 lost connection:... (1 Reply)
Hi experts , im new to Unix,AWK ,and im just not able to get this right.
I need to match for some patterns if it matches I need to print the next few words to it.. I have only three such conditions to match… But I need to print only those words that comes after satisfying the first condition..... (2 Replies)
Hello Guyz
I have been following this forum for a while and the solutions provided are super useful. I currently have a scenario where i need to search for a pattern and start searching by keeping the first pattern as a baseline
ABC
DEF
LMN
EFG
HIJ
LMN
OPQ
In the above text i need to... (8 Replies)
Hi, I have 2 files that I have modified to basically match each other, however I want to determine what (if any) line in file 1 does not exist in file 2. I need to match column $1 and $2 as a single string in file1 to $1 and $2 in file2 as these two columns create a match.
I'm stuck in an AWK... (9 Replies)
Hello !
Experts, I saw a ton of postings here about Awk pattern matching and even after going through all of it, what I have concocted isnt working for me.
Here is what I am after.
I have a huge set of csv files and in the fifth column, I have text like this ---
ANFD10239CS9
BCDD93948CS9... (5 Replies)