How to write a page break character.
From: Chetak Sasalu (chetak.sasalu_at_wipro.com)
Date: 12/20/03
- Previous message: Jeff Westman: "Win32 Registry"
- Next in thread: Randy W. Sims: "Re: How to write a page break character."
- Reply: Randy W. Sims: "Re: How to write a page break character."
- Reply: John W. Krahn: "Re: How to write a page break character."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 20 Dec 2003 13:07:18 +0530 To: <ajey@pdx.edu>
Hi,
I want to search for the word "status" in a group of files in a
directory and replace it with "status\n^L" where ^L is a page break
chatacter, In vi I can type it in using cntrl+l.
I want to do this by
perl -p -i.old -e 's/^STATUS$/STATUS\n(page break character)/' *
How can I "write" the page break character (^L) on command line?
Thanks,
Chetak
-----Original Message-----
From: Ajey [mailto:ajey@pdx.edu]
Sent: Saturday, December 20, 2003 7:43 PM
To: Douglas Lentz
Cc: David Inglis; beginners@perl.org
Subject: Re: how to remove a ^M charaters from a variable
if its a unix file,.open in vi
:%s/ctrl+v ctrl+m//g
(where ctrl+v and ctrl+m gives the ^M character.)
cheers
On Fri, 19 Dec 2003, Douglas Lentz wrote:
> David Inglis wrote:
>
> >I am reading in a csv file and it has a control character ^M at the
> >end of each line how can I remove these charaters, I have tried the
> >following and had no success.
> >
> >$a=~s/\^M//;
> >$a=~s/^M//;
> >
> >
> >Any help appreciated thanks.
> >
> >
> >
> >
> This is an MS-DOSsy file, where each line is terminated by the famous
> CR/LF combination. "^M" is the carriage return. Between the regex
> slashes ("the jungle") "^" means "beginning of line", so what you have
> instructed regex to do is erase any capital "M" that happens to occur
at
> the beginning of a line.
>
> If you have a copy of the program dos2unix around, it will take care
> of
> this for you, otherwise you can try $a =~ s/\x0D//;
>
> which means replace any CR you find with null. HTH.
>
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
<http://learn.perl.org/> <http://learn.perl.org/first-response>
Confidentiality Notice
The information contained in this electronic message and any attachments to this message are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged information. If
you are not the intended recipient, please notify the sender at Wipro or Mailadmin@wipro.com immediately
and destroy all copies of this message and any attachments.
- Previous message: Jeff Westman: "Win32 Registry"
- Next in thread: Randy W. Sims: "Re: How to write a page break character."
- Reply: Randy W. Sims: "Re: How to write a page break character."
- Reply: John W. Krahn: "Re: How to write a page break character."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|