add service authenticationserver*$serviceName -connectorType $connectorType -ipAddress $ipAddress -port $port -domain *$domain -authenticationType $authenticationType -connector $connector -userName $userName -password $password -iconPath $iconPath -description $description
for $(variables) i will pass the parameters
every time i will skip one attribute and execute the command
example looks like this
In the first iteration authenticationserver $serviceName should be skipped
add service -connectorType connectorType -ipAddress $ipAddress -port $port -domain $domain -authenticationType $authenticationType -connector $connector -userName $userName -password $password -iconPath $iconPath -description $description
in the second iteration -connectorType $connectorType should be skipped and so on
add service authenticationserver $serviceName -ipAddress $ipAddress -port $port -domain $domain -authenticationType $authenticationType -connector $connector -userName $userName -password $password -iconPath $iconPath -description $description
i tried by using the awk and cut
cat kalyan.txt | grep -v `awk -F"-" '{ print $10}' /tmp/kalyan.sh`
nothing is displayed
cat kalyan.sh | awk -F"-" '{ print $10}'
# awk -F"-" '{ print $2}' /tmp/kalyan.sh
authenticationserver $serviceName
my assumption is to catch the attribute and negate in the above command
---------- Post updated 07-27-11 at 12:48 AM ---------- Previous update was 07-26-11 at 09:18 AM ----------
how to impliment it ... can any one give a clue
---------- Post updated at 12:49 AM ---------- Previous update was at 12:48 AM ----------
can any one give a clue..
I'm not sure I understand the requirement ...
This code:
p='authenticationserver*$serviceName -connectorType $connectorType -ipAddress $ipAddress -port $port -domain *$domain -authenticationType $authenticationType -connector $connector -userName $userName -password $password -iconPath $iconPath -description $description'
awk -v p=$p 'BEGIN {
n = split( p, t )
for ( i = 0; ++i <= n; )
if ( t[i - 1] ~ /^-/ && t[i - 1] = t[i - 1] FS t ) delete t
for ( i = 0; ++i <= n; ) t && t[++c] = t
print "add service", p
for ( i = 0; ++i <= c; ) {
for ( j = 0; ++j <= c; ) {
if ( j == 1 ) printf "add service%s", FS
if ( j == i ) continue
if ( t[j] )
printf "%s", ( t[j] FS )
}
print x
}
}'
Produces the following output:
add service authenticationserver*$serviceName -connectorType $connectorType -ipAddress $ipAddress -port $port -domain *$domain -authenticationType $authenticationType -connector $connector -userName $userName -password $password -iconPath $iconPath -description $description
add service -connectorType $connectorType -ipAddress $ipAddress -port $port -domain *$domain -authenticationType $authenticationType -connector $connector -userName $userName -password $password -iconPath $iconPath -description $description
add service authenticationserver*$serviceName -ipAddress $ipAddress -port $port -domain *$domain -authenticationType $authenticationType -connector $connector -userName $userName -password $password -iconPath $iconPath -description $description
add service authenticationserver*$serviceName -connectorType $connectorType -port $port -domain *$domain -authenticationType $authenticationType -connector $connector -userName $userName -password $password -iconPath $iconPath -description $description
add service authenticationserver*$serviceName -connectorType $connectorType -ipAddress $ipAddress -domain *$domain -authenticationType $authenticationType -connector $connector -userName $userName -password $password -iconPath $iconPath -description $description
add service authenticationserver*$serviceName -connectorType $connectorType -ipAddress $ipAddress -port $port -authenticationType $authenticationType -connector $connector -userName $userName -password $password -iconPath $iconPath -description $description
add service authenticationserver*$serviceName -connectorType $connectorType -ipAddress $ipAddress -port $port -domain *$domain -connector $connector -userName $userName -password $password -iconPath $iconPath -description $description
add service authenticationserver*$serviceName -connectorType $connectorType -ipAddress $ipAddress -port $port -domain *$domain -authenticationType $authenticationType -userName $userName -password $password -iconPath $iconPath -description $description
add service authenticationserver*$serviceName -connectorType $connectorType -ipAddress $ipAddress -port $port -domain *$domain -authenticationType $authenticationType -connector $connector -password $password -iconPath $iconPath -description $description
add service authenticationserver*$serviceName -connectorType $connectorType -ipAddress $ipAddress -port $port -domain *$domain -authenticationType $authenticationType -connector $connector -userName $userName -iconPath $iconPath -description $description
add service authenticationserver*$serviceName -connectorType $connectorType -ipAddress $ipAddress -port $port -domain *$domain -authenticationType $authenticationType -connector $connector -userName $userName -password $password -description $description
add service authenticationserver*$serviceName -connectorType $connectorType -ipAddress $ipAddress -port $port -domain *$domain -authenticationType $authenticationType -connector $connector -userName $userName -password $password -iconPath $iconPath
Don't quite understand the requirement. Anyway, the below code will give you an idea:
awk '
iteration==0 && / authenticationserver[*][$]serviceName/ {
sub("authenticationserver[*][$]serviceName", "")
print
++iteration
next
}
iteration==1 && / -connectorType [$]connectorType/ {
sub("-connectorType [$]connectorType", "")
++iteration
print
}' kalyan.txt