Delete a string from config

hi i am trying to automate a Firewall config and i have a bellow line in
a congig …

“user1” “user2” “user3” “User4” …
“user100”

now i need to delete string “user2”

but dont understand what would be the best way

i was thinking to spilit this into array then delete the value then
create again with same syntax from array

can any one please help me .

On Mon, Aug 13, 2012 at 1:18 PM, Fosiul A. [email protected]
wrote:

hi i am trying to automate a Firewall config and i have a bellow line in
a congig …

Someone just asked here about deleting lines from a file; this would
be pretty much the same (i.e. you’d read in the file, make your
deletions in the in-memory copy, and then write it out to disk).

can any one please help me .
I guess that depends on how the data’s laid out. If it’s really
“user2” in quotation marks, I would do a gsub on /“user2”/ and replace
it with nothing (unless you want to delete whitespace on one side or
another, in which case you’d add that to your regular expression). But
it might make sense to split it, delete instances of the string, and
then rejoin it, before writing back to disk.

Hi thanks
and sorry for late reply.

when i connect to fw by ssh and type the command

"show user group fosiultest "

I get bellow output

config user group
edit “fosiultest”
set member "user1 “ "user2 “ "user3 “ "user4 “ "user5 “
"user6 “ "user7 “ "user8 “ "user9 “ "user10 “

next

end

so now i need to grab this line
set member "user1 “ "user2 “ "user3 “ "user4 “ "user5 “ "user6 “
"user7 “ "user8 “ "user9 “ "user10 “

and have some how have to delete user3 .

but dont understand how to do that …

On Aug 14, 2012, at 2:07 AM, Fosiul A. [email protected] wrote:

HI Sorry
the final file i got it like this

      set member "user1" "user2" "user3" "user4" "user5" "user6"

“user7” “user9” “user10” “user11” “user12” “user13” " user14" " user15"
" user16" " user17" " user18" " user19" " user20"

From here I wil have to delete a user call user7

how i do that ?

Can you please clarify? Are we doing your job or your homework?

HI Sorry
the final file i got it like this

        set member "user1" "user2" "user3" "user4" "user5" "user6" 

“user7” “user9” “user10” “user11” “user12” “user13” " user14" " user15"
" user16" " user17" " user18" " user19" " user20"

From here I wil have to delete a user call user7

how i do that ?

LOL
definitely not homework!!

but i have done it anyway
thanks for the help.

Look at the tokenizer. use the string to be removed as the divider like
the comma in a csv.
Then output the tokens as a single string. (all remove all instances of
it).