Line-To-Line

I have one string like this:

Hello, I am a shopkeeper (linefeed)
Thus, I like to say... (linefeed)
Good Morning (linefeed)

How can I put this string line-to-line recording it into a file?
0
Jeremias
8/30/2002 12:05:46 PM
sybase.powerbuilder.general 62418 articles. 16 followers. Follow

2 Replies
1053 Views

Similar Articles

[PageSpeed] 58

How about something like this....

long ln_pos,ln_filenum,ln_start_point
string tmp_part

ln_start_point = 1
//fileopen
ln_filenum = FileOpen("c:\export.txt",LineMode!,Write!,LockWrite!,Replace!)

ln_pos = Pos(ls_your_string,'~n',1) //~r~n if CR LF 
for ln_pos > 0 
    tmp_part = Mid(ls_your_string,ln_start_point,ln_pos)
    FileWrite(filenum,tmp_part)
    ln_start_point = ln_pos + 1  // + 2 if CR LF
    ln_Pos = Pos(ls_your_string,'~n',ln_pos + 1) // + 2 if CR LF
next

Fileclose(ln_filenum)


Please bare in mind that the ~n is for the linefeed, if it's carriage 
return in your file, you have to change the '~n' to '~r~n' , and also add 2 
instead of 1 position in the code.
I wrote this code out of my head, didn't test it though... lack of time ... 
( as usual ) :=)


HTH
John Vanleeuwe

0
John
8/30/2002 12:20:23 PM
Thank you
0
Jeremias
8/30/2002 1:22:54 PM
Reply:

Similar Artilces:

Line by line
Hi, I have a file extremely large in size and length. I want to read the file line by line and worry about matching up each line and running that line through a subroutine instead of opening the entire file (which would take a while). So how do I open a file up and process each line individually? On Dec 17, 2003, at 7:28 PM, PerlDiscuss - Perl Newsgroups and mailing lists wrote: > Hi, I have a file extremely large in size and length. I want to read > the > file line by line and worry about matching up each line and running > that > line through a subroutine i...

Lines, what lines?
Given all the talk about high voter turnout, I got to the polls about 15 minutes after they opened at 7:15am. This was about the same time I went in 2006. The line today was about the same as then. It took about 30 minutes to vote for McCain and go. By the time I left, the line was about 30% shorter. Weather was good and parking was adequate. Are the reports of long waits just media hype? Don Abel wrote: > Are the reports of long waits just media hype? Maybe you ought to read Kirt's post in the Mark 8:10 blabla thread. Don Abel wrote: > Are the reports of long waits...

retreiving each line, line by line in a multiline tyextbox??
I have a multi line textbox and I need to be able to retreive the data in the textbox but line by line. Meaning: that in a multiline textbox in which a user has typed text which fills up 3 lines in the textbox; I need to retreive the first line, and then the second etc.. I figure since there is a text wrap, the data inside the textbox control must contain some formating characters somewhere like a line break, or new line, or linefeed etc... How is this done please? Thanks marc Why would you want to retrive each line independly?  One quick approach would be taking the whole string...

Printing line by line
Hi, want to send info to the remote printers in a one by one line wayany ideaThanks...

reading in a file, line by line by picking certian lines
Hi all I am looking at a way of reading a line doing a regex to find the specific line then pick out the line, sudo code would be some thing like the following: read in line check regex if regex is correct { jump 10 lines print the output } any ideas on jumping the 10 lines, how do I ignore the lines in the file, and know I'm going the right distance ? Thanks Pat On Fri, Jun 20, 2008 at 09:06, Pat Rice <patrick.j.rice@gmail.com> wrote: > Hi all > > I am looking at a way of reading a line doing a regex to find the > specific line then pi...

to read a line 2 lines above a line having a grepped string...
hi all, suppose i have a file having the following data.. SN = TOM FDN = SALLY OPERATIONAL STATE = ENABLED Now suppose i grep the string "ENABLED", i get the third line.But from this very line i need to go 2 lines above and get the SN value also.Please suggest . regards' Dilip > From: dilip [mailto:dilipkrishna82@gmail.com] > Sent: 11 November 2008 11:18 > To: beginners@perl.org > Subject: to read a line 2 lines above a line having a grepped string... >=20 > hi all, >=20 > suppose i have a file having the following data.. ...

reading line by line
Hi, I have a program that contains a pretty big block of text: my $text = <<EOF; line1 line2 .... line 120000 EOF I want to read this block of text line by line and analyse each line without needing to create a big array that contains all these lines (exactly like when reading line by line from a text file). It works fine if the program contains just a block of text, because in that case I can put the data after __DATA__ and then use while(<DATA>), but the program contains 2 blocks of text. Is there a solution for this? Thank you. Octavian On 08/09...

Line by Line Printing
I am trying to print a datawindow "line by line" using a Matrix printer. Does anyone have any idea on how I can accomplish this? PB 7.0 TIA, Austin open the port (either serial or parallel ) using CreateFile ( if serial you will have to deal with speed, stop bits, character length, and flow control, see MSDN example for serial communications) compose the data as a string and write to the port close the file <Austin Phillips> wrote in message news:41678ec6.4f4a.1681692777@sybase.com... > I am trying to print a datawindow "line by line" using a &...

Lines between Lines in Mail list window instead of colouring the lines
Name: Marco Email: marcoatxandriadotde Product: Thunderbird Summary: Lines between Lines in Mail list window instead of colouring the lines Comments: Hi, for the next Thunderbird version it would be great to have an optical change of the display of the email list. Right now the lines are coloured one grey / one white to make the list view more eye friendly, but if you have group view enabled ("today", "yesterday" and so on), the group headers are also coloured and that makes it a bit chaotic. Suggestion: Please separate the lines with thin black or grey li...

RE: How to get 1st line, last line and no of lines in a file
> -----Original Message----- > From: Madhu Reddy [mailto:saitech74@yahoo.com] > Sent: Wednesday, February 19, 2003 1:25 PM > To: beginners@perl.org > Subject: How to get 1st line, last line and no of lines in a file > > > Hi, > How to get first line, last line and no of lines in > a file..... > > is there any perl functions available for that ? > right now what i am doing is > > open file > while (<FH> > { > $lines++; > } > close(FH) > > This operation is expensive.. > suppose, if file...

Reading file line by line regardless of type of end-of-line?
I would like to create a perl script that reads lines from an ascii file, but that reads them regardless of whichever of the three variants (<CR>, <LF> or <CR><LF>) is actually in use as end-of-line, *without* knowing beforehand which is the case. The script should run on many systems (so installing a special version of Perl is out of the question). Now perl has the input_line_separator which you can set to a value, sadly though, it is not a regular expression. Which means that I am looking for a trick or a method to handle text files line by line regar...

Read line by line from a file & search each line on another file
Want to do a perl program - Read from file 1 - line1, line2....etc Search line1 on file2 (all lines) Then Search line 2 on file 2... Ouput results of search. manu wrote: > Want to do a perl program - > > Read from file 1 - line1, line2....etc > Search line1 on file2 (all lines) > Then Search line 2 on file 2... > > Ouput results of search. > > What code do you have so far? -- Just my 0.00000002 million dollars worth, Shawn Programming is as much about organization and communication as it is about coding. I like Perl; it&...

Pattern matching line by line
I'm trying to match a patern in a string but I want to do it a line at a time. Is there an easier way than this : while ($a =~ m/(.+?)\n/g ) { if ($1 =~ /whatever/g) { print "$1"; } why not to split the String first something like foreach my $line (split(/\n/, $a)) { if ($line =~ /whatever/) { print $line; } } shall do the trick Marcos > -----Original Message----- > From: bzzt [mailto:stafili@hotmail.com] > Sent: Wednesday, June 16, 2004 1:33 PM > To: beginners@perl.org > Subject: Pattern matching line by line...

Parsing texbox line by line
I would like to user a texbox (big one) to have users enter information on a perline basis, and to parse this line by line. What is the best way to accomplish this? You mean, enter line, parse, enter next line, parse, etc? You'd have to do that in client code, no? Will they need to be able to edit what they've already written? Yikes, could be complicated. What is the task you're trying to accomplish? (Perhaps there's an easier way?)-- Mike PopeASP.NET User EducationThis posting is provided "AS IS" with no warranties, and confers no rights. They will not need to edit once en...

Web resources about - Line-To-Line - sybase.powerbuilder.general

Resources last updated: 12/8/2015 10:17:38 PM