How to verify process as uppercase


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to verify process as uppercase
# 1  
Old 09-26-2011
Bug How to verify process as uppercase

Hi,
I'm using ksh, I have a server process run in the background called fin_tr_APPADJ. I have a requirement now to create a script to check if all the processes spawn with process named fin_tr_* must be uppercase, fin_tr_ can be lower case, but anything suffixed with fin_tr_* must be uppercase. The script will return 0 if all uppercase, otherwise return 1.
Appreciate if anyone can helps.

Thanks in advance.

best regards
# 2  
Old 09-26-2011
For example,

Code:
   root 2880       1   2  11:34:04 /usr/bin/bash
   root 364    2880   2  11:34:10 fin_tr_APPADJnox
   root 264       1   3  11:40:15 /usr/bin/bash
   root 4644     352   4  12:17:12 fin_tr_APPADJi
   root 2452    4644   4  13:21:45 fin_tr_APPADJ

Code:
ps -ef |awk -F \_ '/fin_tr_/ && $NF!=toupper($NF) {a++}END{print  a?"1":"0"}'

# 3  
Old 09-26-2011
Hi,
Thanks a tons! Is there anyway i can construct this using if-then-else? just wondering how do you manually create the process fin_tr_APPADJi, fin_tr_APPADJ and fin_tr_APPADJnox?

---------- Post updated at 12:21 PM ---------- Previous update was at 12:01 PM ----------

i tried run the command, it still returning as 1 even though i have APPADJ as uppercase.
Code:
ps -ef |awk -F \_ '/fin_tr_/ && $NF!=toupper($NF) {a++}END{print a?"1":"0"}'

I tried below command just check the suffixed (APPADJ), but I'm not sure how to check the upper case:
Code:
ps -ef | grep fin_ | grep tr_ |awk '{print substr($9,8)}'

Any help would great appreciate.

Last edited by Franklin52; 09-26-2011 at 09:46 AM.. Reason: Please use code tags for data and code samples, thank you
# 4  
Old 09-26-2011
Code:
 
$ ps -ef | perl -F_ -lane '{print $_ if($_=~/fin_tr/ && uc($F[2]) eq $F[2])}'
root 2452    4644   4  13:21:45 fin_tr_APPADJ

# 5  
Old 09-26-2011
Quote:
Originally Posted by khchong
i tried run the command, it still returning as 1 even though i have APPADJ as uppercase.

ps -ef |awk -F \_ '/fin_tr_/ && $NF!=toupper($NF) {a++}END{print a?"1":"0"}'
That script works...understand that if it returns 1 it means there are processes prefixed with "fin_tr" with lowercase letters in them.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Uppercase to lowercase

Hello, I have a list of files in a directory whose names are all in uppercasse, including the file format for eg *.MP3 . I would like to convert these to the normal way we write it ie ABC.MP3 to be converted to Abc.mp3 . I know that this can be done manually by using a lot of "mv" or rename... (6 Replies)
Discussion started by: ajayram
6 Replies

2. Shell Programming and Scripting

Change to uppercase

Hi I have a string(can be mix of upper and lower case) and need the first three chars of the string to be converted to uppercase (4 Replies)
Discussion started by: Northpole
4 Replies

3. HP-UX

How to verify the size of a process

Hi, Could you please advise on the command to verify the size of a process in HPUX 11.23 Itanium. The process name is arserverd. Many thanks in Advance, Best Regards, John Joseph (2 Replies)
Discussion started by: jjosephHPUX
2 Replies

4. UNIX for Dummies Questions & Answers

UPPERCASE to lowercase

Hi All, i have a file and i want to convert all uppercase letters to lowercase letters which are in my file. how can i do this. Thanx (3 Replies)
Discussion started by: temhem
3 Replies

5. UNIX for Dummies Questions & Answers

uppercase to lowercase

i have no variable and no file i just want to convert AJIT to ajit with some command in UNIX can anybody help (4 Replies)
Discussion started by: ajit.yadav83
4 Replies

6. AIX

Lowercase to Uppercase

Inside a script I have 2 variables COMP=cy and PT=t. further down the same script I require at the same line to call those 2 variables the first time uppercase and after lowercase ${COMP}${PT}ACE,${COMP}${PT}ace. Can somebody help me Thanks in advance George Govotsis (7 Replies)
Discussion started by: ggovotsis
7 Replies

7. Shell Programming and Scripting

Conversion to uppercase - tr

Hi, I am trying to convert the $i in loop from lower to upper case but getting error like ' awk: 0602-502 The statement cannot be correctly parsed. The source line is 1.' .. Requirement: I have many table in script XXX.sql which starting with 'ABC_','AbC_','aBc_' etc.. same thing for table... (2 Replies)
Discussion started by: subrat
2 Replies

8. Shell Programming and Scripting

verify if a process exists (ps)

hi I want to verify that a process exists. if the process exists, then it means the service is up. ps -ef | grep monito returns an entry if the service is up. how to translate that in a shell script?? many thanks (4 Replies)
Discussion started by: melanie_pfefer
4 Replies

9. Shell Programming and Scripting

Converting to Uppercase

I want to convert string into uppercase string. How can i do that ? Ex: Enter the user name: read name show=upper(name) echo $show --- This output should be the uppercase output. Thanks (3 Replies)
Discussion started by: dreams5617
3 Replies

10. Shell Programming and Scripting

uppercase to lowercase

Greetings & Happy New Years To All! A client of mine FTP'ed their files up to the server and it all ended up being in UPPERCASE when it all should be in lowercase. Is there a builtin command or a script anyone knows of that will automagically convert all files to lowercase? Please advise asap... (4 Replies)
Discussion started by: webex
4 Replies
Login or Register to Ask a Question