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:[EMAIL PROTECTED] Sent: Saturday, December 20, 2003 7:43 PM To: Douglas Lentz Cc: David Inglis; [EMAIL PROTECTED] 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: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > <http://learn.perl.org/> <http://learn.perl.org/first-response> > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <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 [EMAIL PROTECTED] immediately and destroy all copies of this message and any attachments. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>