Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > General

Reply
 
Thread Tools Display Modes
  #1  
Old 03-19-2020, 08:14 AM
klc1802 klc1802 is offline
Registered User
 
Join Date: Apr 2014
Posts: 8
Highlight the command

Hi expert,
I want to highlight the command after the pattern.
Example:
The output will highlight the command "ps -ef | grep mysql" after pattern '#'.
like below
root@PHUOCPT-X1C:~# ps -ef | grep mysql
root 233 187 0 21:10 pts/0 00:00:00 grep --color=auto mysql
root@PHUOCPT-X1C:~#

So what is the Regular Expression is used in this case?
My secureCRT version is 8.7.1
Reply With Quote
  #2  
Old 03-19-2020, 08:32 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,293
Hi klc1802,

Will it always be root user?

Or do you need to account for any user?
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 03-19-2020, 09:28 AM
klc1802 klc1802 is offline
Registered User
 
Join Date: Apr 2014
Posts: 8
Hi bgagnon,
I hope you understand my idea.
Pls don't care root user or any user. Just highlight the command after the prompt (#)
Reply With Quote
  #4  
Old 03-19-2020, 12:40 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,293
Hi klc1802,

I think so. And since lookbehind is now supported, we think something like this will work for you:

(?<=\S\S\S\S\S\S\S\S# ).*
Does it mark the data as expected?
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730

Last edited by bgagnon; 03-19-2020 at 12:41 PM. Reason: Removed white space
Reply With Quote
  #5  
Old 03-20-2020, 05:22 AM
klc1802 klc1802 is offline
Registered User
 
Join Date: Apr 2014
Posts: 8
Hi bgagnon,
It doesn't work as expected.
I added (?<=\S\S\S\S\S\S\S\S# ).* in Keyword Highlighting setting and set blue color for this Regular Expression.
But the output show that the command don't change to blue color.
Pls check the screenshot as attached.
Attached Images
File Type: jpg Screenshot_1.jpg (58.9 KB, 41 views)
File Type: jpg Screenshot_2.jpg (197.1 KB, 37 views)
Reply With Quote
  #6  
Old 03-20-2020, 07:45 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,293
Hi klc1802,

That's odd because I temporarily changed my prompt to match yours and it worked, see below.



Let's get a raw log so we can see if there's something else in your prompt that interferes with the regex working properly.

To create a raw log:
  • Before connecting with the session, select Raw Log Session from SecureCRT's File menu.
  • In the Select Log File dialog, choose a folder and filename in which you would like the log text to be stored and press the Save button. At this point, if you open the File menu, you will notice that the Raw Log Session menu item now has a check-mark next to it; this indicates that raw logging is activated.
  • Now connect to the remote machine and perform the actions that cause the behavior.
  • Select Raw Log Session from the File menu to turn off the raw logging feature (and disconnect the session, if desired).
Since a raw log can contain sensitive information, feel free to send it as an attachment via email to support@vandyke.com. Please reference "Attn Brenda - Forum Thread #14112" in the subject line.
Attached Images
File Type: png forumKLC1802.png (7.8 KB, 81 views)
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #7  
Old 03-20-2020, 08:14 AM
klc1802 klc1802 is offline
Registered User
 
Join Date: Apr 2014
Posts: 8
Hi bgagnon,
Pls find the raw log as attached.
Attached Files
File Type: zip 2020.03.20_21.07.59_Default.zip (601 Bytes, 15 views)
Reply With Quote
  #8  
Old 03-20-2020, 08:31 AM
klc1802 klc1802 is offline
Registered User
 
Join Date: Apr 2014
Posts: 8
Hi bgagnon,
After I move the regex up as first priority and it worked.
Thank you very much for support!
Reply With Quote
  #9  
Old 03-20-2020, 08:45 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,293
Hi klc1802,

Thanks for the update. I could not see any in the screenshot that might interfere but I see now that was probably not the complete list.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 07:49 PM.