| View previous topic :: View next topic |
| Author |
Message |
bbelcher Contributor

Joined: 30 Jul 2002 Posts: 172
|
Posted: Fri Jan 09, 2004 1:50 pm Post subject: combine multiple lines into one |
|
|
Hello all,
I have a problem that I cant seam to get handle on.
I have a text file that I'm trying to combine into one line. Hears an example. The desired output would be something like this and all on a single line.
acl add name=internal_cobra pos=2 action=allow agent=server \ authmethods=password authneeded=yes destburb=internal nataddr= \ service=cobra sourceburb=internal \ comments='Allow access to Cobra, inside only' \ lastchangedby='root on 12/28/03 10:28:36'
acl add name=internal_cobra pos=2 action=allow agent=server \
authmethods=password authneeded=yes destburb=internal nataddr= \
service=cobra sourceburb=internal \
comments='Allow access to Cobra, inside only' \
lastchangedby='root on 12/28/03 10:28:36'
acl add name=login_console pos=3 action=allow agent=server \
authmethods=password authneeded=yes destburb=Firewall \
nataddr=host:localhost service=console sourceburb=Firewall \
lastchangedby='root on 12/28/03 10:28:36'
acl add name=deny_hackers pos=4 action=deny agent=proxy authneeded=no \
destburb=internal nataddr= source=netgroup:deny_ext sourceburb=external \
comments='Questionable access' lastchangedby='root on 12/28/03 10:28:36'
Any Ideas. |
|
| Back to top |
|
 |
Dr. Dread Professional Member


Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Fri Jan 09, 2004 2:19 pm Post subject: |
|
|
Step through your file line by line and add each one to the same variable. Like this
| Code: |
list create,1
list loadfile,1,yourinputfile
repeat
%%line = @next(1)
%%outputline = %%outputline%%line
until @equal(@index(1),@count(1))
|
After that you should have everything in one line in %%outputline
Greetz
Dr. Dread _________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|
| Back to top |
|
 |
bbelcher Contributor

Joined: 30 Jul 2002 Posts: 172
|
Posted: Fri Jan 09, 2004 3:24 pm Post subject: |
|
|
I left out one little problem.
I would like to combine each line the starts with acl with the lines below it. Then combine another line starting with the next line starting with acl.
example.
acl add name=internal_cobra pos=2 action=allow agent=server \ authmethods=password authneeded=yes destburb=internal nataddr= \ service=cobra sourceburb=internal \ comments='Allow access to Cobra, inside only' \ lastchangedby='root on 12/28/03 10:28:36'
acl add name=internal_cobra pos=2 action=allow agent=server \ authmethods=password authneeded=yes destburb=internal nataddr= \ service=cobra sourceburb=internal \ comments='Allow access to Cobra, inside only' \ lastchangedby='root on 12/28/03 10:28:36'
Thanks for the help. |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Fri Jan 09, 2004 4:07 pm Post subject: |
|
|
Something like this?
| Code: | list create,1
list loadfile,1,yourinputfile
repeat
%%line = @next(1)
if @equal(@substr(%%line,1,3),ACL)
%%outputline = %%outputline@cr()%%line
else
%%outputline = %%outputline%%line
end
until @equal(@index(1),@count(1)) |
_________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
| Back to top |
|
 |
|