Disclaimer: I am 67 and not in school. I am doing this for my own
satisfaction.
How do I get a new line at the end of a non-quoted text. I am doing the
following:
Use Math::Trig;
print pi * 2;
print \n;
How do I get the new line on the same line of code?
I could do my $my_pi_times_two = pi * 2
On May 23, 2014, at 2:45 PM, Sherman Willden wrote:
Disclaimer: I am 67 and not in school. I am doing this for my own
satisfaction.
How do I get a new line at the end of a non-quoted text. I am doing the
following:
Use Math::Trig;
print pi * 2;
print \n;
How do I get the new line
print pi * 2, \n;
On Fri, May 23, 2014 at 4:45 PM, Sherman Willden
sherman.will...@gmail.com wrote:
Disclaimer: I am 67 and not in school. I am doing this for my own
satisfaction.
How do I get a new line at the end of a non-quoted text. I am doing the
following:
Use Math::Trig;
print pi
Please post messages to the list, not to me personally. That way, you will get
better answers sooner.
On May 23, 2014, at 3:13 PM, Sherman Willden wrote:
Thank you, Jim;
How do I get rid of the warning message without getting rid of the -w switch?
Use the 'use warnings;' pragma in your
On Fri, 23 May 2014 15:52:11 -0700
Jim Gibson jimsgib...@gmail.com wrote:
Use the 'use warnings;' pragma in your program instead of '-w' on the
first line. That way, you can control which messages are issued.
Some modules have to do unsafe things to get the job done; it's the
only way. But
Hi,
I would like to print a file under windows using perl but with the
end of line character be only 0x0A and not 0x0D followed by 0x0A. Is
there a way to set $\ to 0x0A so that every time I use print, it only
prints 0x0A and NOT 0x0D followed by 0x0A. Any other method would also
be welcomed.
On 10-10-13 04:16 PM, Amish Rughoonundon wrote:
Hi,
I would like to print a file under windows using perl but with the
end of line character be only 0x0A and not 0x0D followed by 0x0A. Is
there a way to set $\ to 0x0A so that every time I use print, it only
prints 0x0A and NOT 0x0D followed by
Hiya
I got a string like so, and for the likes of me I can get regex to have
it that each line is starts with #abc#.
my $a =
#aaa#message:details;extra:info;variable:times;#bbb#message:details;extra:info;variable:times;#ccc#not:always;the:same;ts:14:00.00;;
$a =~ s/(?!#.#)/$1\n/i;
Im so
Brent Clark wrote:
Hiya
Hello,
I got a string like so, and for the likes of me I can get regex to have
it that each line is starts with #abc#.
my $a =
#aaa#message:details;extra:info;variable:times;#bbb#message:details;extra:info;variable:times;#ccc#not:always;the:same;ts:14:00.00;;
$a
On 8/12/07, Mr. Shawn H. Corey [EMAIL PROTECTED] wrote:
snip
perl -pi -le '$_ = something if $. == 10' your_file
So if this was in a script rather than a oneliner how would it work?
I was playing and can not get it to work in an actual test script.
Not surprising since it's not correct.
On Aug 9, 6:46 am, [EMAIL PROTECTED] (Chas Owens) wrote:
On 8/8/07, Jeff Pang [EMAIL PROTECTED] wrote:
snip perl -pi -e '$i++;s/^.*$/something/ if $i==10' your_file
snip
There is no need to keep track of the number of lines with a separate
variable. Perl already does this with the $.
[EMAIL PROTECTED] wrote:
On Aug 9, 6:46 am, [EMAIL PROTECTED] (Chas Owens) wrote:
On 8/8/07, Jeff Pang [EMAIL PROTECTED] wrote:
snip perl -pi -e '$i++;s/^.*$/something/ if $i==10' your_file
snip
There is no need to keep track of the number of lines with a separate
variable. Perl already does
-Original Message-
From: [EMAIL PROTECTED]
Sent: Aug 11, 2007 9:58 PM
To: beginners@perl.org
Subject: Re: Replacing the n'th line with the new line
On Aug 9, 6:46 am, [EMAIL PROTECTED] (Chas Owens) wrote:
On 8/8/07, Jeff Pang [EMAIL PROTECTED] wrote:
snip perl -pi -e '$i++;s
On 8/8/07, Jeff Pang [EMAIL PROTECTED] wrote:
snip
perl -pi -e '$i++;s/^.*$/something/ if $i==10' your_file
snip
There is no need to keep track of the number of lines with a separate
variable. Perl already does this with the $. variable. Also, a regex
that replaces everything is pointless,
Hi
Is there any way to update the specified line in the file with the new
line without having to copy the entire contents once again. Since the
file is huge, i dont want to re-write the file. Can anyone suggest me
how to do this
Thanks
Subhash
--
To unsubscribe, e-mail: [EMAIL PROTECTED
Subhash wrote:
Hi
Is there any way to update the specified line in the file with the new
line without having to copy the entire contents once again. Since the
file is huge, i dont want to re-write the file. Can anyone suggest me
how to do this
If the line you are replacing is the same size
-Original Message-
From: Subhash [EMAIL PROTECTED]
Sent: Aug 8, 2007 10:34 PM
To: beginners@perl.org
Subject: Replacing the n'th line with the new line
Hi
Is there any way to update the specified line in the file with the new
line without having to copy the entire contents once again
line character after the three dots at the
end of the first line. But I can't figure out how to get past it. The
\n don't work. I've tried using chomp and then removing the new line
character but it still doesn't match.
Below is my code that I'm trying to get working and can't seem to get
login
I seem to be matching it in ActiveState's regular expression toolkit,
but when I try running the code it doesn't match the lines. I've
tracked it down to the new line character after the three dots at the
end of the first line. But I can't figure out how to get past it. The
\n don't
Romeo Theriault wrote:
: Hello, I'm trying to match this line (or more than one) starting from
: the words user picard...
:
: 8/28/2006 1:04:41 PM: Retrieving mail from host mail.maine.edu
: [130.111.32.22], user picard...
: 8/28/2006 1:04:45 PM: Mail retrieval failed, reason: POP3 Host did
:
and returned following error: -ERR \[AUTH\]
Invalid login
I seem to be matching it in ActiveState's regular expression toolkit,
but when I try running the code it doesn't match the lines. I've
tracked it down to the new line character after the three dots at the
end of the first line. But I can't
: -ERR \[AUTH\] Invalid login
I seem to be matching it in ActiveState's regular expression toolkit,
but when I try running the code it doesn't match the lines. I've
tracked it down to the new line character after the three dots at the
end of the first line. But I can't figure out how to get past
following error: -ERR \[AUTH\] Invalid
login
I seem to be matching it in ActiveState's regular expression toolkit,
but when I try running the code it doesn't match the lines. I've
tracked it down to the new line character after the three dots at the
end of the first line. But I can't figure
Chris Devers wrote:
On Wed, 26 Oct 2005, Timothy Johnson wrote:
I think you can use \r instead of \n for Access and Excel.
Are you sure about that?
I thought Windows used \r\n as a pair (or \n\r?) for the line delimiter.
But then, I don't do Windows anymore, so I could be wrong
. What should I
use to get Access to display a new line?
--
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: [EMAIL PROTECTED]
website: http://www.nusconsulting.com.au
--
To unsubscribe
I think you can use \r instead of \n for Access and Excel.
-Original Message-
From: Daniel Kasak [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 26, 2005 4:18 PM
To: beginners@perl.org
Subject: New Line Character(s)
Greetings.
I've got some Perl code that's inserting data
On Wed, 26 Oct 2005, Timothy Johnson wrote:
I think you can use \r instead of \n for Access and Excel.
Are you sure about that?
I thought Windows used \r\n as a pair (or \n\r?) for the line delimiter.
But then, I don't do Windows anymore, so I could be wrong :-)
--
Chris Devers
If you have \n on its own in Access or Excel you get a new line within a
cell.
Also if you only have \n all the way through the file, then you
effectively have one huge record which can't be loaded into memory (size
dependent);
\r\n is required in windows to indicate the end of a line.
\n only
Hello,
Can someone explain how I can add \n to this line of code If that is
really my problem.. :~)
copy ($print_file, '//hp-exch/HP4100-IS');
The reason I ask is here's what I'm printing; (teminal veiw)
--begin
left
pGreen Solutions Industrial Cleaner is a non-toxic, heavy-duty
I am stucking with my problem of reading xml file ,
I am trying to remove the new line chars form xml file and just readout the xml
tags.
Please any guys have a look at this one.
please guide me some good stuff abut regex in perl .
Thanks and Regards,
abhishek
I am stucking with my problem of reading xml file ,
I am trying to remove the new line chars form xml file and just
readout the xml tags.
Please any guys have a look at this one.
please guide me some good stuff abut regex in perl .
perldoc perlretut
perldoc perlre
Have fun!
Steve
On Thu, 21 Oct 2004 11:23:59 -0400 (EDT), Steve Bertrand
[EMAIL PROTECTED] wrote:
I am stucking with my problem of reading xml file ,
I am trying to remove the new line chars form xml file and just
readout the xml tags.
Please any guys have a look at this one.
please guide me some
Abhishek Dave wrote:
I am stucking with my problem of reading xml file ,
I am trying to remove the new line chars form xml file and just
readout the xml tags.
If you're trying to parse XML, use an XML parser.
http://perl-xml.sourceforge.net/faq/
--
To unsubscribe, e-mail: [EMAIL
Hi All
As a beginner in PERL, I wrote a small program which reads data from the file and
stores in an array. In that process i wanted to skip the new line character...
for ex: In my program
say a.txt contains
man
pan
tan
In the program
open INPUT,a.txt or die $!;
my @file = INPUT;
when I
-- Forwarded message --
From: David le Blanc [EMAIL PROTECTED]
Date: Thu, 9 Sep 2004 16:54:56 +1000
Subject: Re: how to skip new line character
To: Anish Kumar K. [EMAIL PROTECTED]
Is the problem either
1) Remove the end of line character from all lines
2) Remove the end of line
open F, file.txt;
my @file = F;
chomp @file;
print @file;
Is that what you want ?
- Original Message -
From: Anish Kumar K. [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, September 09, 2004 2:41 PM
Subject: how to skip new line character
Hi All
As a beginner in PERL, I wrote
Codes goes along this way :
$current_record = $_;
if (substr($current_record, 0, 6) eq 'GRSUMC') {
# Remove new line marker
chomp($current_record = $current_record);
# Attach run no to end of record
$current_record = $current_record . $run_no . \n
David Clarke wrote:
Hi, does anyone know what the new line character value is in Hex for
a text file ? Is it 0d 0a ?
ASCII newline is 0x0A (decimal 10)
On Unix-ish systems, text files end each line with a single newline.
On Windows systems, text files end each line with a CR/LF pair (0x0D
On Jul 23, 2004, at 7:16 AM, Bob Showalter wrote:
On Mac systems, the terminator is something different (not sure what),
but
the same concept applies as for Windows AFAIK.
Mac OS 9 and below used a single CR (0x0D) as the line terminator. Mac
OS X is a Unix-ish system, as you described it, and
James Edward Gray II wrote:
On Jul 23, 2004, at 7:16 AM, Bob Showalter wrote:
On Mac systems, the terminator is something different (not sure
what), but the same concept applies as for Windows AFAIK.
Mac OS 9 and below used a single CR (0x0D) as the line terminator.
Thanks. Is
On Jul 23, 2004, at 7:56 AM, Bob Showalter wrote:
Thanks. Is translation to LF performed on input/output (a la Windows),
or is
$/ set to CR on those systems?
No translation. $/ was set to CR and even \n gave you a CR.
Luckily, as I said before, Mac OS X is a much more native Perl, being
in the
Hi, does anyone know what the new line character value is in Hex for a text file ? Is
it 0d 0a ?
I'm trying to read in a line of text, chomp it, attach 3 digits at the end of this
line, then write this line to output file. But when I write it out, the original input
line is written out
david [EMAIL PROTECTED] wrote:
Jeff Westman wrote:
I need a one-liner to convert all occurances read from a Unix
pipe
of
'backslash' + 'literal new line (hex 0a)'
to become just
'literal new line (hex 0a)'
That is, remove the '\' only when it preceeds a new-line
I need a one-liner to convert all occurances read from a Unix pipe
of
'backslash' + 'literal new line (hex 0a)'
to become just
'literal new line (hex 0a)'
That is, remove the '\' only when it preceeds a new-line. Again,
this must be read from a pipe. This is what I have so far
Jeff Westman wrote:
I need a one-liner to convert all occurances read from a Unix pipe
of
'backslash' + 'literal new line (hex 0a)'
to become just
'literal new line (hex 0a)'
That is, remove the '\' only when it preceeds a new-line. Again,
this must be read from a pipe
Jeff Westman wrote:
I need a one-liner to convert all occurances read from a Unix pipe
of
'backslash' + 'literal new line (hex 0a)'
to become just
'literal new line (hex 0a)'
That is, remove the '\' only when it preceeds a new-line. Again,
this must be read from a pipe
I wrote a script that generates an excel file. I tested it on a windows
xp pro machine and everything was ok. When I put the script on the UNIX
server and run it I get blocks on my excel sheet where new lines
occurred. How can I have the UNIX Perl write out Microsoft new line
characters so
- Unix New line
I wrote a script that generates an excel file. I tested it on
a windows xp pro machine and everything was ok. When I put
the script on the UNIX server and run it I get blocks on my
excel sheet where new lines occurred. How can I have the UNIX
Perl write out Microsoft new line
I am reading in a text file that has input similar to this.
date|data|data|data\n
I then read the file in and using a while loop I chomp off the new line.
while (IPO){
chomp;
@line=split /\|/,$_;
$line[2]=~s/ //g;
print $_ foreach (@line);
last;
$count++;
last
I am reading in a text file that has input similar to this.
date|data|data|data\n
I then read the file in and using a while loop I chomp off
the new line. while (IPO){
chomp;
@line=split /\|/,$_;
$line[2]=~s/ //g;
Do you mean $line[3] since that is the last one in the array
any of the array elements when printed act as if they have a new line.
So it would be the last array element printed. In the case it could be 3
but it could also be 2 or 4.
-Original Message-
From: Dan Muey [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 16, 2003 10:49 AM
To: Paul
any of the array elements when printed act as if they have a
new line. So it would be the last array element printed. In
the case it could be 3 but it could also be 2 or 4.
Then do a froeach loop on each item in the array replacing \n's and \r's and
spaces( if you want to kill space
PROTECTED]]
Sent: Thursday, January 16, 2003 10:49 AM
To: Paul Kraus; Perl
Subject: RE: Where is the new line coming from.
I am reading in a text file that has input similar to this.
date|data|data|data\n
I then read the file in and using a while loop I chomp off
the new line. while
attached is a copy of the excel file if it helps.
-Original Message-
From: Paul Kraus [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 16, 2003 11:03 AM
To: 'Dan Muey'; 'Perl'
Subject: RE: Where is the new line coming from.
come to think of it. This newline I am getting must
Paul Kraus wrote:
attached is a copy of the excel file if it helps.
Paul
You have CRLF at the end of the line. chomp will only remove the LF. Try
s/[[:cntrl:]]$//g;
instead of chomp.
HTH,
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL
.
Try that and see.
Dan
-Original Message-
From: Paul Kraus [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 16, 2003 11:03 AM
To: 'Dan Muey'; 'Perl'
Subject: RE: Where is the new line coming from.
come to think of it. This newline I am getting must be a
result
from?
-Original Message-
From: Dan Muey [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 16, 2003 11:22 AM
To: Paul Kraus; Perl
Subject: RE: Where is the new line coming from.
attached is a copy of the excel file if it helps.
I see it now.
It's probably some odd
that.
-Original Message-
From: Dan Muey [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 16, 2003 11:22 AM
To: Paul Kraus; Perl
Subject: RE: Where is the new line coming from.
attached is a copy of the excel file if it helps.
I see it now.
It's probably some
Paul Kraus wrote:
Interesting When I run the script on my windows box (5.6.1) I get
this output
DEBUG : NON PRINT ACHAR -011747-
DEBUG : NON PRINT ACHAR -Eco-Liner w/Att A=30-35 B=23-29cm -
DEBUG : NON PRINT ACHAR -139.45-
Same script same source file run on sco
Paul Kraus wrote:
Interesting When I run the script on my windows box
(5.6.1) I get
this output
DEBUG : NON PRINT ACHAR -011747-
DEBUG : NON PRINT ACHAR -Eco-Liner w/Att A=30-35 B=23-29cm
- DEBUG :
NON PRINT ACHAR -139.45-
Same script same source file run
tested it on
a windows xp pro machine and everything was ok. When I put
the script on the UNIX server and run it I get blocks on my
excel sheet where new lines occurred. How can I have the UNIX
Perl write out Microsoft new line characters so that the
excel sheet looks normal?
You need
to reinstall perl to get it to remove the
new line?
In one of my other files while writing it printed out
a square box for a newline character that I was trying
to remove. Has anyone had this happen?
Thanks,
Tricia
__
Do you Yahoo!?
Yahoo! Mail
;
}
my($printcap) = join(|,@caption);
$printcap=~ s/\n//g;
print CAP $printcap;}
Quoting a scalar variable is almost always unnecessary.
close(CAP);
Output:
Variety Story
|Local Church
|Local Fairgrounds
|Bellys full
Do I have to reinstall perl to get it to remove the
new line
i have just started writing some scripts in PERL and i am trying to catch a deadline,
i really wish i could get some help for this problem. any suggestion is greatly
appreciated.
i have a set of files with sequences aligned in the following format. i wonder how i
can eliminate the new line
.
Original Message Follows
From: s wang [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: how can i get rid of these new line characters?
Date: Fri, 4 Oct 2002 08:00:19 -0700 (PDT)
i have just started writing some scripts in PERL and i am trying to catch a
deadline, i really wish i could
Follows
From: s wang [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: how can i get rid of these new line characters?
Date: Fri, 4 Oct 2002 08:00:19 -0700 (PDT)
i have just started writing some scripts in PERL and i am trying to catch a
deadline, i really wish i could get some help
eliminate the new line characters within each sequence
without touching those between sequences?
I think the easiest way is to read in a line, then read the next line. If
the next line is NOT \n, then remove the last character from the
previous line:
open DNA, dna.txt or die can't read dna.txt
eliminate the new line characters within each sequence
without touching those between sequences?
Heh, a much simpler way is:
open DNA, dna.txt or die can't read dna.txt: $!;
open NEW_DNA, dna.txt.new or die can't write dna.txt.new: $!;
{
local $/ = ;
while (DNA) {
chomp; # get
for this
problem. any suggestion is greatly appreciated.
i have a set of files with sequences aligned in the following format.
i wonder how i can eliminate the new line characters within each
sequence without touching those between sequences?
.
2 chr1 10761 10775 chr19 46520370 46520384 + 941
eliminate the new line characters within each
sequence without touching those between sequences?
.
2 chr1 10761 10775 chr19 46520370 46520384 + 941
acaGGGAACAA
acagggaaggg
3 chr1 10776 11241 chrUn 45411478 45411944 - 12857
-Original Message-
From: s wang [mailto:[EMAIL PROTECTED]]
Sent: Friday, October 04, 2002 11:00 AM
To: [EMAIL PROTECTED]
Subject: how can i get rid of these new line characters?
i have just started writing some scripts in PERL and i am
trying to catch a deadline, i really
eliminate the new line characters within each sequence
without touching those between sequences?
.
2 chr1 10761 10775 chr19 46520370 46520384 + 941
acaGGGAACAA
acagggaaggg
3 chr1 10776 11241 chrUn 45411478 45411944 - 12857
-Original Message-
From: Gareth Londt [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 01, 2001 10:54 AM
To: [EMAIL PROTECTED]
Subject: a new line?
i need to know where to put a new line in.i keep
getting errors..?
here is what the code looks like, if anyone can
perlvar for a better explanation.
Cheers
Mark C
$/ is the var for this, so you should say:
$/=\n\n;
have a nice day.
On Tue, 3 Jul 2001 [EMAIL PROTECTED] wrote:
i'd like to define a new line separator as a simple blank
line. i have
tried \n\n and even tried ^$ in the way
i'd like to define a new line separator as a simple blank line. i have
tried \n\n and even tried ^$ in the way of a regex, but to no avail. is
there a metacharacter specific to this?
-cjm
$/ is the var for this, so you should say:
$/=\n\n;
have a nice day.
On Tue, 3 Jul 2001 [EMAIL PROTECTED] wrote:
i'd like to define a new line separator as a simple blank line. i have
tried \n\n and even tried ^$ in the way of a regex, but to no avail. is
there a metacharacter specific
Can anyone send me any solution
to read the paragraph from a text file?
To read paragraphs (delimited by one or more blank
lines (really blank, no spaces or tabs)), change the
record separator from its default (newline) to the
null string ('').
$/ = '';
while () {
print;
CAn any one suggest a pattern for checking the newline character at the end
of line?
Problem:Actually the requirement is that I want to read no. of lines by
comparing the newline character which will tell that this is the end of
paragraph? Can anyone send me the code for this or any
That code is a bit tricky, since you're now changing the behaviour of $/
throughout the entire file
A bit safer way to do this would be the following:
open I, yourfile.txt;#open a textfile for reading
{ local $/;#undef $/, which is essentially the
same as $/ =
A bit safer way to do this would be the following:
Jos is right in principle, but wrong in one detail.
Setting $/ to undef isn't the same as setting it to ''.
Setting it to undef makes the input operator
slurp the whole file.
: this is what i tryed on the command prompt.
:
: perl -pi -e 's{^!--\ntd}{test}' hello.txt
:
: but this command is not working .. so anybody kindly please help me in getting a
:regular expression for this.
Two things:
1. The -p flag by itself will only read in one line of hello.txt at a
81 matches
Mail list logo