need to print the follwoing:
need smart way by printf to pring this example
param1 ............... value1
param2 ............... value2
param3 ............... value1
param4 ............... value2
THX
more file
param1=" 1,deerfntjefnerjfntrjgntrjnvgrvgrtbvggfrjbntr*rfr4fv*frfftrjgtrignmtignmtyightygjn 2,3,4,5,6,7,8,
rfcmckmfdkckemdio8u548384omxc,mor0ckofcmineucfhcbdjcnedjcnywedpeodl40fcrcmkedmrikmckffmcrffmrfrifmtrifmrifvysdfn"
need to match the content of $param1 in the file
but its not work for example
sed -n "/$param1/p" file
or any grep $param1 file etc...
any other solutions? maybe with perl?
I need to print the following values with printf as the follwoing around like this:
printf "[date +%d"/"%b"/"%G"-"%T] [WARN] $PARAM1 $PARAM2 $PARAM3
The required output:
[02/Jun/2010-11:08:42] [WARN] val1....val2...val3
the gap between val1 to val2 and from val2 to val3 must be const gap not depend the length of the values
Is it possible to change the perl syntax (described down) to replace "a" string in the line that match "param1" as the following example:
more test
param1=a
a
param2=b
b
aa
bb
a
b
aa
bb
[root@localhost tmp]# perl -pe "s/\b$a\b/$b/g unless /^#/" test
param1=asdfghj
asdfghj (this line shuld not be chaged)
param2=b
b
aa
bb
a
b
aa
bb
[root@localhost tmp]#
The right output
param1=asdfghj
a
param2=b
b
aa
bb
a
b
aa
bb
[root@localhost tmp]#
According to the following Perl command
( this command part of ksh script )
I can replaced old hostnames with new hostnames in Linux or Solaris
previos_machine_name=linux1a
new_machine_name=Red_Hat_linux1a
export previos_machine_name
export new_machine_name
.
perl -i -pe 'next if /^ *#/; s/(\b|[[:^alnum:]])$ENV{previos_machine_name}(\b|[[:^alnum:]])/$1$ENV{new_machine_name}$2/g' file
EXPLAIN: according to perl command - we not replaces hostnames on the follwoing case:
RULE: [NUMBERS]||[letter]HOSTNAME[NUMBERS]||[letter]
my question
after I used the Perl command in order to replace all old hostnames with new hostnames
based on the "RULE" in the Perl command
how to verify that the old hostnames not exist in file ?
for example
previos_machine_name=linux1a
new_machine_name=Red_Hat_linux1a
more file
AAARed_Hat_linux1a verification should be ignore from this line
@Red_Hat_linux1a$ verification should be match this line
P=Red_Hat_linux1a verification should be match this line
XXXRed_Hat_linux1aZZZ verification should be ignore from this line
.
.
.
.
I want to replace the a string with the word string as the following example down , but if a string exist also after comment then a string will replaced too
In which way I can add to the sed command the irregular exp that ignore from the #.
[root@localhost tmp]# more test
a
b
aa
bb
#a
#b
#aa
#bb
[root@localhost tmp]# sed "/\/ s/a/WORD/g" test
WORD
b
aa
bb
#WORD
#b
#aa
#bb
[root@localhost tmp]#
I have the two perl command
perl -pe "s/\b$a\b/$b/g if m/param1 /" test
and
perl -pe "s/\b$a\b/$b/g unless /^#/" test
how to use combine the if m/somthing/ and the unless /something/
for example
[root@localhost tmp]# perl -pe "s/\b$a\b/$b/g if m/param1/ unless /^#/" test
syntax error at -e line 1, near "m/param1/ unless"
but its now work
THX
Hi
I have VB script that run second VB script
The second VB script ask some questions from the input box
My problem is that “MyShell.Run” not wait until SecondVBscript.vbs will ended
And the Other VB syntax run immodestly also
Need to wait for MyShell.Run process ended and then perform the Other VB syntax
How can I do that?
Set MyShell = Wscript.CreateObject("WScript.Shell")
MyShell.Run " C:\Program Files\SecondVBscript.vbs"
Set MyShell = Nothing
Other VB syntax
Hi I have VB script that run second VB script The second VB script ask some questions from the input box My problem is that “MyShell.Run” not wait until SecondVBscript.vbs will ended And the Other VB syntax run immodestly also
Need to wait for MyShell.Run process ended and then perform the Other VB syntax How can I do that?
Set MyShell = Wscript.CreateObject("WScript.Shell")
MyShell.Run " C:\Program Files\SecondVBscript.vbs"
Set MyShell = Nothing
Other VB syntax
hi
I have in file file_test values of right eye and left eye
How to separate the file_test to file1 and file2 by awk in order to write the equal values on file1 and different values on file2 as the following example down
THX
file_test:
NAME: jim
LAST NAME: bakker
right eye: |5|<
left eye VALUE: |5|<
NAME: Jorg
LAST NAME: mitchel
right eye: |3|<
left eye VALUE: |5|<
NAME: jimmy
LAST NAME: kartter
right eye: |6|<
left eye VALUE: |5|<
NAME: david
LAST NAME: kann
right eye: |9|<
left eye VALUE: |9|<
file1:
NAME: jim
LAST NAME: bakker
right eye: |5|<
left eye VALUE: |5|<
NAME: david
LAST NAME: kann
right eye: |9|<
left eye VALUE: |9|<
file2:
NAME: Jorg
LAST NAME: mitchel
right eye: |3|<
left eye VALUE: |5|<
NAME: jimmy
LAST NAME: kartter
right eye: |6|<
left eye VALUE: |5|<
hi
I have the following script that replace a param to b param and match only the c parameter in line
how to change the perl syntax: "if /$c/" in order to export c param to the follwoing perl syntax
!/bin/bash
export a='@d&'
export b='new text'
export c='bla bla'
echo $c | perl -pe 'next if /^#/; s/(^|\s)\Q$ENV{a}\E(\s|$)/$1$ENV{b}$2/ if /$c/'
hi friends
I use the following command to find under /var some param in my script
grep -R "param" /var/* 2/dev/null |grep -wq "param"
my problem is that: after grep find the param in file
grep continue to search until all searches under /var/* will completed
How to perform stop immediately after grep match the param word
For example when I run the:
grep -R "param" /var/* 2/dev/null |grep -wq "param"
grep find the param after one second.
But grep continue to sears other same param and its take almost 30 seconds
How to stop the grep immediately after param match?
THX
I have two Perl one liners:
perl -pe "s/\b$a\b/$b/g if m/param1 /" test
and
perl -pe "s/\b$a\b/$b/g unless /^#/" test
How can I combine theif m/somthing/ and the unless /something/, like:
[root@localhost tmp]# perl -pe "s/\b$a\b/$b/g if m/param1/ unless /^#/" test
syntax error at -e line 1, near "m/param1/ unless"
hi
I am try to run the go.bat from VB but when I run the script I get: :cant find specific file
but from the cmd window the file go.bat exsit what the problem?
Dim MyShell
Dim shell_cmd
shell_cmd = "C:\Program Files\dir1\dir2\wizard\go.bat"
set MyShell = CreateObject("WScript.Shell")
MyShell.Run shell_cmd, 1, 1
from cmd window
C:\Program Files\dir1\dir2\wizardgo.bat
Is there a way to invoke a local program in JSP?
for example, to add a button to a jsp page, and when the user press the button the windows calculator app will be opened.
Thanks
The following VB script check the valid IP by Test function
if we get OK from the test function then
We break from loop ValidIP=OK
If not the inputBox ask the question until ValidIP=OK
But sometimes I want to exit from loop by cancel button
How to break loop by the cancel button (in order to set the ValidIP as OK)
Do Until ValidIP=OK
IPrange=InputBox("Enter IP address range",,"172.17.202.1-10,192.9.200.1-100")
Test IPrange, strPattern
Loop
ho to verify by VB script syntax if the file conf C:\Program Files\conf
exist under Program Files ?
for example
if it exist then msgBox print file exist
if not the msgBox print file not exist
THX
I need to print the following values with printf as the follwoing around like this:
printf "[`date +%d"/"%b"/"%G"-"%T`] [WARN] $PARAM1 $PARAM2 $PARAM3
The required output:
[02/Jun/2010-11:08:42] [WARN] val1....val2...val3
I'm using the colorbox plug in for several messages on my web page and I have one specific message that I want it to appear higher on the screen (so it won't hide the center of the page).
Is there a parameter that controls the colorbox location on load?
Thanks.
more file
param1=" 1,deerfntjefnerjfntrjgntrjnvgrvgrtbvggfrjbntr*rfr4fv*frfftrjgtrignmtignmtyightygjn 2,3,4,5,6,7,8,
rfcmckmfdkckemdio8u548384omxc,mor0ckofcmineucfhcbdjcnedjcnywedpeodl40fcrcmkedmrikmckffmcrffmrfrifmtrifmrifvysdfn drfr4fdr4fmedmifmitfmifrtfrfrfrfnurfnurnfrunfrufnrufnrufnrufnruf"**
#
need to match the content of param1 as
sed -n "/$param1/p" file
but because the line length (very long line) I cant match the line
what’s the best way to match very long lines?