Search Results

Search: Posts Made By: anilcliff
6,685
Posted By anilcliff
Dry run php script from shell
Is it possible to dry run a php script without actually executing it? Say I need to test the output of a php file to see if it matches a pattern. I need to run this on all php files on the server....
883
Posted By anilcliff
multipe pattern
Extract of configuration file.

members server1.domain1.com,server2.domain2.com,server3.domain3.com

I am writing a script to remove the server members from a conf file. When I run the...
2,521
Posted By anilcliff
escape character not working
I need to change a pattern with single quotes


# echo "serversignature: 'On'"
serversignature: 'On'


I did

# echo "serversignature: 'On'" | sed 's/.*serversignature.*/serversignature:...
881
Posted By anilcliff
Thanks a lot. It worked.
Thanks a lot. It worked.
881
Posted By anilcliff
First Pattern match from last
I need to get the port numbers only from these list.


127.0.0.1:53
0.0.0.0:25
127.0.0.1:953
:::62378
:::47353


Ie print fully from right when the pattern : is matched. The ouput should be...
2,358
Posted By anilcliff
print lines up to pattern excluding pattern
11
22
33
44
55
66
77


When pattern 55 is met, print upto it, so output is


11
22
33
44
11,384
Posted By anilcliff
Yes you are right. The one you gave works...
Yes you are right. The one you gave works flawlessly.
11,384
Posted By anilcliff
This worked # grep username /etc/passwd |...
This worked


# grep username /etc/passwd | sed 's/\/bin\/bash/\/sbin\/nologin/'
username:x:32008:32011::/home/user:/sbin/nologin


---------- Post updated 11-19-11 at 12:01 AM ----------...
11,384
Posted By anilcliff
It comes as follows. ...
It comes as follows.

user:x:32008:32011::/home/user:/bin/bash:/usr/local/my/bin/noshell
11,384
Posted By anilcliff
pattern match and replace another pattern in same line
I have a pattern

username:x:32005:32006::/usr/local/user:/bin/bash

I need to match the line containing username and replace /bin/bash with /usr/local/my/bin/noshell

So it becomes
...
1,930
Posted By anilcliff
replace pattern after the first pattern match
I need this.

aaa
OOOOO
bbb
ccc
OOOOO
ddd
fff
ggg
OOOOO
iii
OOOOO


I need all OOOOO replaced with PPPPP, but only change after the pattern ggg. So the first two OOOOO should not be...
1,421
Posted By anilcliff
I got it corrected. If the count is more than 3,...
I got it corrected. If the count is more than 3, it will display it.


hour=`date | awk {'print $4'} | cut -d: -f 1`;lasthour=`expr $hour - 01`; lasthour=`printf %02d $lasthour`;grep "`date -I`...
1,421
Posted By anilcliff
variable inside a variable
I am trying manipulate variables inside a variable

root@server [~]# hour=`date | awk {'print $4'} | cut -d: -f 1`;lasthour=`expr $hour - 01`; lasthour=`printf %02d $lasthour`;grep "`date -I`...
1,502
Posted By anilcliff
thanks it worked
thanks it worked
1,502
Posted By anilcliff
shell arithmetic least significant place
I need help on arithmetic

root@server [~]# hour=`date | awk {'print $4'} | cut -d: -f 1`; echo $hour
04
Now I subtract this result by 1 or 01 I get "3" as the answer. I need "03" as the answer,...
3,054
Posted By anilcliff
The below gives the nameserver details from the...
The below gives the nameserver details from the zone file. I need the nameservers registered for a domain at the registrar. Should be able to get from command line. The value in the zone file can be...
3,054
Posted By anilcliff
I get the following error: # nslookup...
I get the following error:

# nslookup -qt=any domain.com
*** Invalid option: qt=any
3,054
Posted By anilcliff
uniform and same result whois command line
I am looking for a free whois lookup tool or some "scripting help" that will give uniform result for whois lookup from the linux command line.

Currently:
whois of a .co.nz domain results...
3,400
Posted By anilcliff
print lines with exact pattern match
I have in a file

domain.com. 1909 IN A 1.22.33.44
domain.com. 1909 IN A 22.33.44.55
ns1.domain.com. 1699 IN A 33.44.55.66
ns2.domain.com. 1806 IN A 77.77.66.66


I need to "grep" or "awk"...
989
Posted By anilcliff
I try below server 1# cat file1 aaa bbb ...
I try below

server 1# cat file1
aaa
bbb

server 1# cat file2
ccc
ddd

server 1# cat test.sh
#!/bin/bash
var=`paste file1 file2`
echo $var

server 1 # sh test.sh
aaa ccc bbb ddd

...
989
Posted By anilcliff
using two variables in two different files
I have file1 contents as

aaa
bbb
ccc


file2 contents as

ddd
eee
fff


I need to write for loop with two variables, so that I get the output as follows.
I have a third file that...
1,258
Posted By anilcliff
Thanks xbin, your second code worked fine. :)
Thanks xbin, your second code worked fine. :)
1,258
Posted By anilcliff
variable value return of multiple command
I wrote this script


#!/bin/bash

var=`du -sch /var/log/messages;du -sch /var/log/maillog`
echo $var


I am getting result as follows.

# sh my.sh
2.1M /var/log/messages 2.1M total 296K...
1,649
Posted By anilcliff
bash in perl issue
I use the following shell script in bash and it works fine. It returns 1


[root@server ]# cat /etc/httpd/conf/res.txt
maldet(24444): {scan} scan completed on eicar_com.zip: files 1, malware hits...
2,911
Posted By anilcliff
Thanks a ton it worked :b:
Thanks a ton it worked :b:
Showing results 1 to 25 of 45

 
All times are GMT -4. The time now is 06:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy