Manipulation On A File - Plus Some Regex?

Jan 27, 2012

The below is the content of my file(which is already sorted). Whichever is there between square brackets, relate to one transaction. The transactions can be groupa, groupb,groupc etc.

Jan 2012 02:10:12 [5678](groupa):Part 1:data1
Jan 2012 02:10:12 [5678](groupa):Part 2:data2
Jan 2012 02:10:12 [5678](groupa):Part 3:data3[code]...


I want to output the below data to another file using vb.net. It should contain the transaction group, followed by the time(the time should be taken from the first row of the contents grouped by transaction, then grouped by the number inside the square bracket, in the contents). Next line should concatenate the data(after Part [1-9]:), corresponding to the particular transaction grouped by the number inside the square bracket. For the above contents,

groupa at Jan 2012 02:10:12
data1data2data3data4
groupa at Jan 2012 02:13:14
data1data2
groupb at Jan 2012 02:13:24
data1data2

View 1 Replies


ADVERTISEMENT

VS 2008 String Manipulation Or Regex

Oct 27, 2010

[code] How to substring only the line(s) below the explanation e.g. No match for "VBFORUMSBLAHBLAH.COM". Everything else should be ignored.

View 10 Replies

Text Manipulation From A File.txt?

Dec 9, 2011

So far I have a button that calls scan.bat which simply runs net view and outputs to file.txt. I then want to strip out all the gumpf so it just leaves the names of the PC's in the list (not the remarks and all that).I'm new to all this, so it might not be the most elegant way of doing this!

Imports System.IO
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

[code].....

View 4 Replies

VS 02/03 Text File Manipulation?

Feb 19, 2010

I don't actually know where to post this cuz i don't actually need code, i just need help on the logic. But if i could get a code then that's fine either

you see, i'm trying to get specific details on a text file.For example, the contents of the text file is like this:

[Code]...

View 3 Replies

VS 2010 Txt File Manipulation?

Jun 10, 2010

I have a text file that has about 200 programs that were dumped from a cnc machine. I want to be able to take that text file and extract each program and save it as it's own text file. There is a distinct character at the beginning and the end of each individual program. I an new to vb and the projects that I have done to this date involve database front ends so i have no idea on how to work with text files.

View 32 Replies

ListBox And Text File Manipulation?

Oct 10, 2010

The homework assignment goes like this: write a menu-driven program to manage an employee list. the names should appear in the listBox when the form is loaded. When a name in the listBox is highlighted the name and number txtBoxes are loaded with the correct name and employee number. Use the Update menu items--modify,add,delete to edit the listBox items.When the Exit menu item is clicked the new employee list should be written to the text file and the program should terminate.

Well, the first part was completed successfully, but when I tried to delete a name and number I recieved an error box that said "InvalidOperationException was unhandled", "sequence contains no elements" that pointed to line 35. msdn and help were no help, talked about dataset tables? Did I use the incorrect syntax? Once I resolve this issue, the other two--modify,add should be similar, but then how do I reconstruct the text file so that it will properly load the next time the form is loaded?

Public Class Problem_1_p451
Structure Company
Dim name As String

[code].....

View 3 Replies

Fastest Method Of File IO And Content Manipulation?

Apr 20, 2010

My current project is to process several files. The files come from a Unix server and have been SFTP'd to the Windows XP machine. (That's fixed protocol, I don't have control over it.) My problem now is that the Unix new line characters and Windows characters don't match. The solution is to read the file line by line and replace 0x0A with 0x0D + 0x0A, or Asc 10 with Asc 13 + Asc 10, or vbLf with vbCrLf, however you like to say it.Well I have a working function to do this, but any extra speed I could squeeze out of it would be fantastic. The text files I'm working with can reach sizes of about 100MB. So to the question:

Q: What is the fastest way to read a file in, change characters as necessary and then write the file out?Here is my current working code.

Private Sub FormatCharacters(ByVal files As String())
Try
For Each fileName As String In files
FileSystem.Rename(fileName, fileName & ".old")

[code]....

View 1 Replies

File I/O And Registry :: String Line Manipulation

Jul 17, 2009

I thought you could use a structure as a container. I have line_1 with a line of data read in from a file. I only want to Look in position 1 of the line and position 8 for 9 and position 31 for 11. If I create a line_2 with the parts broken out for pieces that I want to look at then I could use a with statement right?

[Code]...

View 3 Replies

VS 2005 File Reader & String Manipulation

Feb 2, 2010

a text document containing information as:In/memory of/wendy/smith 6th of march 1545/ foreever in our thought/love liz and pony/i`ve got to develop a software in vb that will read the text file above and extract names, date.for each inscription it is required to display on a computer screen, IN TABULAR FORM, the details mention above.

View 10 Replies

Resources For PDF File Vector Graphic Search And Manipulation?

Oct 3, 2009

I am looking for tools that will enable me to search and manipulate pdf files and pdf vector graphics. I want to search a pdf image/file for specific content and then manipulate the image. Are there any known resources out there? I have looked at the documentation on the Adobe web site, but I don't know where to begin. I'm looking for books or a forum where I can get specific information and examples.

View 1 Replies

Visual Studio 2010 WinForms Application File Manipulation?

Feb 26, 2012

I have a list of .txt, .doc, .pdf on my listview. How do i code this problem;

1. When i double-click the item (sample.txt) on my listview it will open in a notepad.

2. When i double click the item (sample.docx or sample.doc) it will open the MS word and shows me the things written on the particular item.

View 4 Replies

Regex - Reading File Large File Very Slow?

Aug 26, 2011

this code takes about 30 mins and high cpu usage, what is the problem

Do
strLine = objReader.ReadLine()
If strLine Is Nothing Then

[code].....

View 3 Replies

Concatenating A Variable With A Regex Group Match In Regex.replace?

Apr 5, 2012

I am having an issue where I am using regex.Replace to replace part of a string. The basic idea is that I want to capture the beginning of the string then replace the end of the string with a value from code. For an example pretend I have a string that says "Test Number " followed by number and I want to increment that number. I capture the "Test Number " but when I try to concatenate that capture with the new number it treats the capture ($1) as a literal and replaces the entire string with $1[new number].

[code]...

This will output "We are on Test Number 2", as expected. how I can use a variable in the replacement string portion of the Regex.Replace when including a captured group?

View 1 Replies

Regex: Take Text & Some Special Characters Between The Xml Tags Using Regex On C#.net?

Feb 23, 2012

I want to take the text and some special characters between the xml tags.. My input file contains:

[Code]...

now i want the Regex to take text and the special characters between the tags <line>,<inline>..

View 2 Replies

Increment Regex Match Using Regex.Replace

Jun 21, 2012

I'm creating a program in VB.NET to output multiple images. Some images will have the same file name. If there is multiple files with the same name I want to add "_1_" to the end of the file name. If the "_1_" file already exists I want to increment the 1 to be "_2_". If this file already exists I want to continue incrementing the number ultil it doesn't exist. So for example "filename", filename_1_", "filename_2_", etc. Here is the code that I have tried

[Code]...

View 1 Replies

Regex Builder That Actually BUILDS RegEx From A Highlight

Nov 17, 2011

I've been working straight since yesterday trying to get this to work. I'm a noob to RegEx and I've tested out about 5 different RegEx "builders" but each of them require you to navigate through the options to build the Regex...each of them has failed when I try to use them.Is there an application out there free/paid where you select the line you want to grab and the RegEx is auto generated from that highlight rather than having to try to build the line of code? [code]

View 1 Replies

.net - RegEx To Get Path Of File Without Domain?

Jun 30, 2009

it's like a diff language to me. But I need one quick to accomplish a task.I need to take

[URL]

and get just

/folder1/folder2/file_path.txt

from it.

View 4 Replies

Regex - Parsing File For Pattern RH 09/27/08 11:49 11:49:00.024

Mar 1, 2010

Trying to parse a text file for records starting with an RH space and a date. I need to return the entire line. I expect to find about 6000 in the file. Example of a full record:

RH 09/27/08 11:49 11:49:00.224 COA292 H393 2664FB753 178 -54.82 8.98 C 431 264 13 040 34 24.45-074 58 57.93 H Snipit of text file:

[Code]...

View 2 Replies

Use RegEx In Extracting Data In A File?

Apr 13, 2009

I've tried to extract certain data using Regex in a File. but it seems not working.No errors and warnings have been found.[code]...

View 2 Replies

VS 2008 RegEx : How To Parse This File

Apr 7, 2009

I'm messing around with regular expressions and I can't seem to figure out how to parse this file.It's basically a lua file containing a table like:

TableName = {
["QuotedString"] = {
["QuotedString"] = {

[code]....

Some things with the file are standard, like the "TableName" (Never in quotes) starts the table. Variables always have [" "] around them and then equal something like ["Test"] = 0. However, the variable could have multiple variables within it. split up the file within each {} and then try to parse each ["QuotedString-Key"] = 0?

View 28 Replies

.net - Parsing Fixed Length File With Regex?

May 8, 2012

I'm parsing fixed length file with .NET 3.5 and Regex. This file is from bank. In customer name sometimes there is one characters from this set &,(),[],',"". These are characters, so far I've encountered. There can be anything else. Because of this my regex is failing. My regex is [A-Za-z0-9s-.,'""""(){}[]]{35}. Is there any wild card I can use for special chars rather than specifying individually. I also tried . but didn't work.

View 2 Replies

Matching A Specific File Name Structure With Regex?

Jun 21, 2011

Regex in VB2008.I have a file system directory that my code is watching. When a file is placed in that directory my code kicks off a processing application. Based on the filename structure, the code will perform different processes. So I need to match the filename structure specficially to get the correct processes to run on that file.My file name structure is: IK2YYYYMMDD_VV.e;where YYYYMMDD is well, the year, month and day. And VV is a verison number from 00-99 If the new file saved in the directory match this structure then I want a TRUE returned. From a filewatcher I get the filename as an "e.Name" (FileSystemEventArgs) variable. My current code to see if it matches the baseline structure is;

Dim IKPred2Match as New Regex ("^IK2.*\.e$") Dim ValidIKPred2Match as MatchCollection = IKPred2Match.Matches(e.Name)I've tried many different regex match patterns, and just can't seem to find the magic one.

View 2 Replies

Parsing Or Regex On HTML In A Text File?

Jun 26, 2009

I just spent about 2 hours searching this forum on this topic but I need some advice. I am looking to extract certain data from HTML source code that I have down loaded into a text file its about 9KB in size.I am looking to keep all email address found. How would this work or what would be the best method to use? This is what I would like to extract and write to another file:

[Code]...

View 20 Replies

RegEx - Parse CSV File And Replace Certain Characters

Sep 2, 2010

I've used regular expressions in the past. I have an app that parses a .csv file and replaces certain characters (commas). Here's an example..
item1, item2, item3, fruits are apples, oranges, grapes. Squash is a vegetable, not a fruit.
What my app does is search each line between character1 and character18 and replace all "," with "~". How this is done through regular expressions?

View 2 Replies

Regex - Verifying The Format Of A Text File?

Feb 9, 2011

I have an application that downloads a .txt file via FTP, and then it calls some sql to insert the file data into my database. I want to check whether the file is in the correct format before trying to insert.

The file should consist of some number of rows, each with the following format:

(4 letter code) (tab) (3 or 4 letter code) (tab) (date as dd-MMM-yy) (tab) (variable length text description) (tab) (1 letter code)

Is there a good way to check whether every line in the file follows this pattern, and warn me if it doesn't?

View 1 Replies

Splitting A CSV File Line Array Using Regex

Jan 5, 2011

I used to do a bit of coding in early versions of VB years ago but moved on to things like RPG400, CL and SQL on an AS/400 box. As I am no longer in this career, I havent touched an AS/400 for a while either.

I am currently working on a visual basic console application in Visual Studio 2005 which takes various csv files from an osCommerce web shop, processes them and writes the data to TAS Books accounts software with the aid of the Infoplex COM module.

I have 2 functions, one reads each line of a csv file into an array, and the second function uses Regex to split the lines array into the various fields before they are added to a structure.

There are something like 5000 records (lines) in the csv file, one example is as follows;

[Code]...

My problem is that due to the formatting of the product description in the example csv line above, it fails the Regex match and therefore fails to read.

I know this is because my pattern is wrong, but I'm not sure how to solve it, I think all I really need is for Regex to split the line by the "," between each element, this might be a little difficult because some of the descriptions contain both , and " but never one after the other.

View 3 Replies

VS 2008 How To Save Regex Matches To Txt File

Mar 9, 2011

Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("http://www.web.com")
Dim response As System.Net.HttpWebResponse = request.GetResponse

[code].....

View 2 Replies

VS 2010 Regex To Find A Pattern In File?

Jan 21, 2012

have a 1mb file, should get the pattern from it

pattern should be like this
6numbers + 10&FF + 6numbers
in the hex binary editor it looks like this

[code].....

View 4 Replies

.net - Defining RegEx To Capture Line Definition From INI File

Feb 18, 2010

defining an expression to capture the four numerics per line that define the lines on a map.

59.684 -4.251 59.575 -5.576
59.575 -5.576 59.437 -6.899
59.437 -6.899 59.27 -8.218

[Code]....

View 3 Replies

RegEx To Parse Valid Paths From A Text File?

Sep 27, 2011

I'm attempting to parse a text file containing several Windows paths; I'd like to use regular expressions if possible, and I'm using VB.NET.The file is formatted somewhat like so:

M - Network Mode
C:ClientSystem - System Path
C:ClientProducts - Product Path

[code].....

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved