Network Automation Software We are currently migrating this forum
over to our HelpSystems domain. Please
post all new threads in our new
HelpSystems Community Portal.
Post to the HelpSystems Forum
You are not currently logged on. You must be logged on in order to post. Log on
Or Create a new account
AutoMate Discussion
Decrease font size
Increase font size
Topic Title: help in extracting text
Topic Summary: extract text at begginning of line
Created On: 10/26/2012 05:19 PM
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
View similar topics View similar topics
View topic in raw text format. Print this topic.
 10/26/2012 05:19 PM
User is offline View Users Profile Print this message

Author Icon
GrantMccormack
Journeyman (50-99)

Posts: 52
Joined: 05/09/2011

Hi all

im having a problem where i need to extract the first 8 characters at the start of every line

the first choice is to use a regex but im unable to compile such a regex as yet, so my second thought is to read the text file line by line, then read the first 8 characters ?

is this possible, i have tried to compile this and have managed to read line by line, but im unable to the output from this.

any help with this would be greatly appreciated

I have many thousands of lines in each text file, and many thousands of txt files per days arriving, so need to find a solution to this that would not drain the server of memory or cpu

many thanks

 10/26/2012 11:25 PM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

Grant,
once you have a line in a variable (theLine)
the 8 leftmost characters can be found as %Left(theLine,8)%

-------------------------
Jean Delfosse - Automate Beta Tester
Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4
 10/28/2012 06:51 AM
User is offline View Users Profile Print this message

Author Icon
JeffTysco
Artisan (200-499)

Posts: 319
Joined: 07/30/2009

The only issue I see is "many thousands of lines in each text file, and many thousands of txt files per day". Depending on your AM version and the actual number of files you could have an issue with the speed of the process.

As Jean touched on, a loop file contents with the Left variable would work...but what are you actually planning to do with this data? There may be a faster way to code this using the Advanced Task.

-------------------------
?? . Your Total IT Solutions Provider
?? . Business Class Hosting Services
 10/28/2012 10:08 AM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

As Jeff mentioned, if you have millions of lines to process per day, Automate loops will be too slow.
Basic script loops would do it much faster (inside a custom basic script)

-------------------------
Jean Delfosse - Automate Beta Tester
Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4
 12/26/2012 01:33 PM
User is offline View Users Profile Print this message

Author Icon
GeraldReid
n00b (>6 posts)

Posts: 3
Joined: 12/26/2012

I'm new to AutoMate and just browsing the forums to get a feel for what issues I might encounter. Not yet knowing the speed with which Automate works, I don't know if this will help but, if I had to do this... I would create a task that loads each file into an Excel spreadsheet which has a macro to remove the beginning of each line and then save the file back out. I would be surprised if this is not considerably faster than reading/writing individual lines. You would only open the Excel spreadsheet once and then load, truncate, save, clear  -   load, truncate, save, clear, et al.

Depending on how the files arrive and how they're named, you could do the entire thing in an Excel macro.

 12/26/2012 06:08 PM
User is offline View Users Profile Print this message

Author Icon
Ricardo Castaneda
HelpSystems

Posts: 3424
Joined: 01/11/2008

Hi Gerald,

Your request can be accomplished using our AutoMate actions and does not require an Excel macro. Have you started to create your task at all?

-------------------------

Ricardo Castaneda | Principal Support Analyst
AutoMate | Division of HelpSystems
HelpSystems, LLC | T: +1.213.738.1700
 12/27/2012 09:49 AM
User is offline View Users Profile Print this message

Author Icon
GeraldReid
n00b (>6 posts)

Posts: 3
Joined: 12/26/2012

Hi Ricardo, I wasn't asking a question, I was providing a belated option/answer to the original post. I'm hoping to start using AutoMate later today after an admin person completes the installation. In the mean time I've been cruising the forums and checking your resources so that I will be better educated when I fire up the product. I'm sure I will be back with my own questions.

Reagrds, Gerald.

 12/27/2012 12:52 PM
User is offline View Users Profile Print this message

Author Icon
Liz Casale
AUTOMATE EMPLOYEE

Posts: 940
Joined: 05/23/2011

Hi Gerald,

Thank you for the clarification Please do post when you have more questions!

-------------------------
Liz Casale
Technical Support Representative
(213) 738-6966
Network Automation, Inc.

--------------------------------------------------------------------------------

AM5 5.5.5.1; AM6 6.2.8.0; AM7 7.1.3.0; AM8 8.0.9.0; AM9 9.0.3.4
BPA7 7.1.3.0; BPA8 8.0.9.0; BPA9 9.0.3.4
 01/02/2013 07:57 PM
User is offline View Users Profile Print this message

Author Icon
JeffTysco
Artisan (200-499)

Posts: 319
Joined: 07/30/2009

Originally posted by: GeraldReid

I'm new to AutoMate and just browsing the forums to get a feel for what issues I might encounter. Not yet knowing the speed with which Automate works, I don't know if this will help but, if I had to do this... I would create a task that loads each file into an Excel spreadsheet which has a macro to remove the beginning of each line and then save the file back out. I would be surprised if this is not considerably faster than reading/writing individual lines. You would only open the Excel spreadsheet once and then load, truncate, save, clear  -   load, truncate, save, clear, et al.




Depending on how the files arrive and how they're named, you could do the entire thing in an Excel macro.



No benefit to that process and just adds another point of failure.

Automate --> Advanced Task (VBA) is simpler than Automate --> Excel --> Macro (VBA)



-------------------------
?? . Your Total IT Solutions Provider
?? . Business Class Hosting Services
Statistics
18258 users are registered to the AutoMate Discussion forum.
There are currently 0 users logged in.
The most users ever online was 5551 on 01/08/2018 at 11:11 AM.
There are currently 1217 guests browsing this forum, which makes a total of 1217 users using this forum.

FuseTalk Enterprise Edition v4.0 - © 1999-2020 FuseTalk Inc. All rights reserved.

Sitemap Network Automation Software Blog