N
Nick Ellson
I have search and replace task and was hoping to get some advice. I
have a large text file of remote access users from Cisco's ACS
dumpfile that I need to batch alter 2000 of 3000 users. And example
user record (they are not all the same size)
#-----------------------------------------------------------------------------
Name : myuser
State : 0
S_flags : 0
Aging policy : group1
Good count : 0
Warning count : 0
Change count : 0
Last change Lo: 1648245808
Last change Hi: 29591352
Last auth Lo : 0
Last auth Hi : 0
Rights : 1
Type : 256
EnableType : 4
Status : 4
Reset : 1
Expiry : 302 103 0 4294963983 0 5
MaxSession : 65535
MaxSess2 : 0
Profile : 1
LogonHrs : 0x0016 00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff
Alias : 0
Value Flags : 524336
CounterVals_00: 0 0 0 0
CounterRst_00 : 0 0
CounterVals_01: 0 0 0 0
CounterRst_01 : 0 0
##--- User End
I have a simple text file of all the usernames that must be acted on
already, and i was hoping to find a scripted method of searching this
file to locate my usernames, then change the TYPE and STATUS lines for
each respective user to alternate values.
My problem is how to do a search that will stop at a username, reach
forward in the file to find the next occurance of TYPE and then
STATUS, make the replacements, and then continue searching the file
for the rest of the usernames.
Doing a bulk replace of all status and type, that's easy with "sed',
and if i could get Grep to go through a file, lock on a name match,
and start sed off from that point I might be ok, but I don't see how
that could be done. So I am betting Perl is my best and perhaps only
option to do this with minimal developement time. Any text
manipulators out there see a way to do this from what I have
described?
Nick
(e-mail address removed)
have a large text file of remote access users from Cisco's ACS
dumpfile that I need to batch alter 2000 of 3000 users. And example
user record (they are not all the same size)
#-----------------------------------------------------------------------------
Name : myuser
State : 0
S_flags : 0
Aging policy : group1
Good count : 0
Warning count : 0
Change count : 0
Last change Lo: 1648245808
Last change Hi: 29591352
Last auth Lo : 0
Last auth Hi : 0
Rights : 1
Type : 256
EnableType : 4
Status : 4
Reset : 1
Expiry : 302 103 0 4294963983 0 5
MaxSession : 65535
MaxSess2 : 0
Profile : 1
LogonHrs : 0x0016 00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff
Alias : 0
Value Flags : 524336
CounterVals_00: 0 0 0 0
CounterRst_00 : 0 0
CounterVals_01: 0 0 0 0
CounterRst_01 : 0 0
##--- User End
I have a simple text file of all the usernames that must be acted on
already, and i was hoping to find a scripted method of searching this
file to locate my usernames, then change the TYPE and STATUS lines for
each respective user to alternate values.
My problem is how to do a search that will stop at a username, reach
forward in the file to find the next occurance of TYPE and then
STATUS, make the replacements, and then continue searching the file
for the rest of the usernames.
Doing a bulk replace of all status and type, that's easy with "sed',
and if i could get Grep to go through a file, lock on a name match,
and start sed off from that point I might be ok, but I don't see how
that could be done. So I am betting Perl is my best and perhaps only
option to do this with minimal developement time. Any text
manipulators out there see a way to do this from what I have
described?
Nick
(e-mail address removed)