[wplug] Re: vi question

Mike Sussman msussman at na-net.ornl.gov
Thu Jul 3 20:14:44 EDT 2003


Scott, etc.:

<ctrl>-V is vi-talk
<ctrl>-Q is emacs-talk

A true vi editor will not use <ctrl>-Q as its quote character,
but editors that know about emacs will accept it.


> Message: 14
> From: Scott Eicher <Scott.Eicher at e-Profile.com>
> To: "WPLUG Mailing List - Linux info (E-mail)" <wplug at wplug.org>
> Date: Thu, 3 Jul 2003 11:06:22 -0400 
> Subject: [wplug] vi question
> Reply-To: wplug at wplug.org
> 
> 
> For you vi users I have a question:
> 
> I would like to delete all ^M control characters from an ascii file. Here is
> what I tried to accomplish this but it doesn't work:
> 
> :%s/\^M//g
> 
> It gives me this message:
> 
> Substitute pattern match failed
> 
> I'm thinking that I'm not specifying the ^M properly but I'm not sure how
> else to specify it.
> 
> Any help would be appreciated.
> 
> Thanks,
> Scott
> 
> --__--__--
> 
> Message: 15
> Date: Thu, 03 Jul 2003 11:12:23 -0400
> From: William Powell <billpwl1 at comcast.net>
> To: wplug at wplug.org
> Subject: Re: [wplug] Stupid BASH Question
> Reply-To: wplug at wplug.org
> 
> You might also want to check the Advanced Bash Scripting Guide -
> 
> http://markdude.members.wplug.org/LDP/abs/html/index.html
> 
> Bill
> 
> >On Thu, 2003-07-03 at 10:50, Wise, Jeremey wrote:
> >  
> >
> >>Ok, I thought this was going to be a simple thing. All I want to do is check
> >>if a file exists. If it does then do the command, otherwise do something
> >>else. I thought the syntax was similar to the if [ ! -d /directory ] but a
> >>-z .... apparently not:>) Man bash yield no clue... as I thought that is
> >>where I got the -z idea.
> >>
> >>****************************
> >>[root at toybox backup]# cat test.scp
> >>#! /bin/bash
> >>if [ -z /etc/fstab ] ; then
> >>   printf "File /etc/fstab exists" ;else
> >>   printf "File Missing"
> >>fi
> >>*****************************
> >>This only prints out "File Missing" but obviously /etc/fstab does exist.
> >>    
> >>
> 
> 
> 
> --__--__--
> 
> Message: 16
> Date: Thu, 3 Jul 2003 11:21:04 -0400
> From: John Harrold <jmh17 at pitt.edu>
> To: wplug at wplug.org
> Subject: Re: [wplug] vi question
> Reply-To: wplug at wplug.org
> 
> 
> --raC6veAxrt5nqIoY
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: inline
> Content-Transfer-Encoding: quoted-printable
> 
> Sometime in July Scott Eicher assaulted the keyboard and produced:
> 
> |=20
> | For you vi users I have a question:
> |=20
> | I would like to delete all ^M control characters from an ascii file. Here=
>  is
> | what I tried to accomplish this but it doesn't work:
> |=20
> | :%s/\^M//g
> |=20
> 
> instead of the carrot+M combination try ctrl+q ctrl+m. this should stick a
> little blue, or whatever color, ^M there.=20
> 
> | It gives me this message:
> |=20
> | Substitute pattern match failed
> |=20
> | I'm thinking that I'm not specifying the ^M properly but I'm not sure how
> | else to specify it.
> |=20
> | Any help would be appreciated.
> |=20
> | Thanks,
> | Scott
> 
> --=20
> --------------------------------------------------------------------------
>                                                | /"\
>  john harrold                                  | \ / ASCII ribbon campaign
>       jmh at member.fsf.org                    |  X  against HTML mail
>            the most useful idiot               | / \
> --------------------------------------------------------------------------
>  What difference does it make to the dead, the orphans, and the homeless,
>  whether the mad destruction is brought under the name of totalitarianism or
>  the holy name of liberty and democracy?
>  --Gandhi
> --------------------------------------------------------------------------
> gpg --keyserver keys.indymedia.org --recv-key F65A739E
> --------------------------------------------------------------------------
> 
> --raC6veAxrt5nqIoY
> Content-Type: application/pgp-signature
> Content-Disposition: inline
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.1 (GNU/Linux)
> 
> iD8DBQE/BEng78vw3vZac54RAtCWAKDPQPRMut/ArVGsoCwjuH/w/ArmGgCfZ0La
> MUz6bBrhDUk/kyFRFkupH2A=
> =FFGn
> -----END PGP SIGNATURE-----
> 
> --raC6veAxrt5nqIoY--
> 
> --__--__--
> 
> Message: 17
> Date: Thu, 3 Jul 2003 11:20:25 -0400 (EDT)
> From: "James O'Kane" <jo2y at midnightlinux.com>
> To: WPLUG <wplug at wplug.org>
> Subject: Re: [wplug] Make error
> Reply-To: wplug at wplug.org
> 
> This one time, at band camp, Arnaud Loos said:
> >      invokes YYERROR.  */
> > #if defined (__GNUC_MINOR__) && 2093 <= (__GNUC__ * 1000 +
> > __GNUC_MINOR__)
> >   __attribute__ ((__unused__))
> > #endif
> > 
> > 
> >   goto yyerrlab2;      <--------- line 5040
> 
> 
> This is an autogenerated file, was it generated on your machine earlier in 
> the build or did they supply a pregenerated file? skim the earlier lines 
> for calls to flex.  
> Or you could move this file to a safe place and try running the build 
> again to see if it regenerates it. My suspicion at this point is it was 
> created with an older flex than will work with your compiler?
> I should point out that I only know enough about flex to be dangerous, I'm 
> not an expert yet.
> 
> -james
> 
> 
> 
> --__--__--
> 
> Message: 18
> Subject: Re: [wplug] vi question
> From: billings at negate.org
> To: wplug at wplug.org
> Organization: TSFNKP
> Date: 03 Jul 2003 11:21:45 -0400
> Reply-To: wplug at wplug.org
> 
> On Thu, 2003-07-03 at 11:06, Scott Eicher wrote:
> > For you vi users I have a question:
> > 
> > I would like to delete all ^M control characters from an ascii file. Here is
> > what I tried to accomplish this but it doesn't work:
> > 
> > :%s/\^M//g
> 
> \^M isn't a control code.
> 
> Try 'control-v control-m'.
> 
> Also, if you are trying to convert a dos file to unix, or vice-versa,
> try 'dos2unix' and 'unix2dos', which should be part of a standard
> install.
> -- 
> Jonathan S Billings <billings at negate.org>
> TSFNKP
> 
> --__--__--
> 
> Message: 19
> Date: Thu, 3 Jul 2003 11:24:44 -0400 (EDT)
> From: "James O'Kane" <jo2y at midnightlinux.com>
> To: wplug at wplug.org
> Subject: Re: [wplug] vi question
> Reply-To: wplug at wplug.org
> 
> This one time, at band camp, John Harrold said:
> > Sometime in July Scott Eicher assaulted the keyboard and produced:
> 
> > instead of the carrot+M combination try ctrl+q ctrl+m. this should stick a
> > little blue, or whatever color, ^M there. 
> 
> Is it really ctrl-q? I was about to answer ctrl-v ctrl-m
> 
> -james
> 
> 
> 
> --__--__--
> 
> Message: 20
> Date: Thu, 03 Jul 2003 11:26:43 -0400
> From: "Doms, Robert S" <rsdoms at switch.com>
> Subject: RE: [wplug] vi question
> To: "'wplug at wplug.org'" <wplug at wplug.org>
> Reply-To: wplug at wplug.org
> 
> I use this perl script to fix the ^M issue.  It creates a file
> filename.strip that is ^M free.  I then copy the .strip file back over the
> original file.  The script removes the first character preceeding a newline.
> In this case, the ^M.  Hope it helps.
> 
> Scott
> 
> 
> strip_ems.pl
> 
> 
> #!/usr/local/bin/perl
> 
> if( $#ARGV != 0 ) {
>     print"\n\aCaution!  This file will remove *ALL* characters imediately
> preceeding a newline!!";
>     print"\nUsage: strip_ems [ filename ]\n\n";
> }
> open( FD, "<$ARGV[0]" );
> open( OUTD, ">$ARGV[0].strip" );
> while( <FD> ) {
>     $_ =~ s/.$//;
>     print OUTD $_;
> }
> 
> 
> 
> > -----Original Message-----
> > From:	John Harrold [SMTP:jmh17 at pitt.edu]
> > Sent:	Thursday, July 03, 2003 11:21 AM
> > To:	wplug at wplug.org
> > Subject:	Re: [wplug] vi question
> > 
> > Sometime in July Scott Eicher assaulted the keyboard and produced:
> > 
> > | 
> > | For you vi users I have a question:
> > | 
> > | I would like to delete all ^M control characters from an ascii file.
> > Here is
> > | what I tried to accomplish this but it doesn't work:
> > | 
> > | :%s/\^M//g
> > | 
> > 
> > instead of the carrot+M combination try ctrl+q ctrl+m. this should stick a
> > little blue, or whatever color, ^M there. 
> > 
> > | It gives me this message:
> > | 
> > | Substitute pattern match failed
> > | 
> > | I'm thinking that I'm not specifying the ^M properly but I'm not sure
> > how
> > | else to specify it.
> > | 
> > | Any help would be appreciated.
> > | 
> > | Thanks,
> > | Scott
> > 
> > -- 
> > --------------------------------------------------------------------------
> >                                                | /"\
> >  john harrold                                  | \ / ASCII ribbon campaign
> >       jmh at member.fsf.org                    |  X  against HTML mail
> >            the most useful idiot               | / \
> > --------------------------------------------------------------------------
> >  What difference does it make to the dead, the orphans, and the homeless,
> >  whether the mad destruction is brought under the name of totalitarianism
> > or
> >  the holy name of liberty and democracy?
> >  --Gandhi
> > --------------------------------------------------------------------------
> > gpg --keyserver keys.indymedia.org --recv-key F65A739E
> > --------------------------------------------------------------------------
> 
> --__--__--
> 
> Message: 21
> From: Scott Eicher <Scott.Eicher at e-Profile.com>
> To: "'wplug at wplug.org'" <wplug at wplug.org>
> Subject: RE: [wplug] vi question
> Date: Thu, 3 Jul 2003 11:27:29 -0400 
> Reply-To: wplug at wplug.org
> 
> I tried ctrl-q but it didn't work. Ctrl-v did work though and I was able to
> get them removed with that.
> 
> Thanks all,
> Scott
> 
> -----Original Message-----
> From: James O'Kane [mailto:jo2y at midnightlinux.com]
> Sent: Thursday, July 03, 2003 11:25 AM
> To: wplug at wplug.org
> Subject: Re: [wplug] vi question
> 
> 
> This one time, at band camp, John Harrold said:
> > Sometime in July Scott Eicher assaulted the keyboard and produced:
> 
> > instead of the carrot+M combination try ctrl+q ctrl+m. this should stick a
> > little blue, or whatever color, ^M there. 
> 
> Is it really ctrl-q? I was about to answer ctrl-v ctrl-m
> 
> -james
> 
> 
> _______________________________________________
> wplug mailing list
> wplug at wplug.org
> http://www.wplug.org/mailman/listinfo/wplug
> 
> --__--__--
> 
> Message: 22
> Date: Thu, 3 Jul 2003 11:35:02 -0400
> From: John Harrold <jmh17 at pitt.edu>
> To: wplug at wplug.org
> Subject: Re: [wplug] vi question
> Reply-To: wplug at wplug.org
> 
> 
> --q9KOos5vDmpwPx9o
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: inline
> Content-Transfer-Encoding: quoted-printable
> 
> Sometime in July James O'Kane assaulted the keyboard and produced:
> 
> | This one time, at band camp, John Harrold said:
> | > Sometime in July Scott Eicher assaulted the keyboard and produced:
> |=20
> | > instead of the carrot+M combination try ctrl+q ctrl+m. this should stic=
> k a
> | > little blue, or whatever color, ^M there.=20
> |=20
> | Is it really ctrl-q? I was about to answer ctrl-v ctrl-m
> 
> since i use vim to send my email:
> 
> with ctrl-q =0D
> with ctrl-v =0D
> 
> so i don't know? i've always done ctrl-q, though i don't really remember
> where i got it from. anyone else know the difference?
> 
> 
> --=20
> --------------------------------------------------------------------------
>                                                | /"\
>  john harrold                                  | \ / ASCII ribbon campaign
>       jmh at member.fsf.org                    |  X  against HTML mail
>            the most useful idiot               | / \
> --------------------------------------------------------------------------
>  What difference does it make to the dead, the orphans, and the homeless,
>  whether the mad destruction is brought under the name of totalitarianism or
>  the holy name of liberty and democracy?
>  --Gandhi
> --------------------------------------------------------------------------
> gpg --keyserver keys.indymedia.org --recv-key F65A739E
> --------------------------------------------------------------------------
> 
> --q9KOos5vDmpwPx9o
> Content-Type: application/pgp-signature
> Content-Disposition: inline
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.1 (GNU/Linux)
> 
> iD8DBQE/BE0m78vw3vZac54RAhQ5AKDaDlTRetD+z5aj9PnaUuGwRWt9DwCgyN0O
> FBWep7CYLNjK2MufKxizAFA=
> =/vh4
> -----END PGP SIGNATURE-----
> 
> --q9KOos5vDmpwPx9o--
> 
> --__--__--
> 
> Message: 23
> Date: Thu, 3 Jul 2003 11:32:21 -0400 (EDT)
> From: "James O'Kane" <jo2y at midnightlinux.com>
> To: wplug at wplug.org
> Subject: Re: [wplug] vi question
> Reply-To: wplug at wplug.org
> 
> This one time, at band camp, John Harrold said:
> > 
> > so i don't know? i've always done ctrl-q, though i don't really remember
> > where i got it from. anyone else know the difference?
> 
> The difference I can tell is that ctrl-v works and ctrl-q doesn't. :)
> At least from a bash shell in an xterm, which I think matter in some 
> manor.
> 
> -james
> 
> 
> 
> --__--__--
> 
> Message: 24
> Date: Thu, 3 Jul 2003 11:50:33 -0400
> From: John Harrold <jmh17 at pitt.edu>
> To: wplug at wplug.org
> Subject: Re: [wplug] vi question
> Reply-To: wplug at wplug.org
> 
> 
> --5oH/S/bF6lOfqCQb
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: inline
> Content-Transfer-Encoding: quoted-printable
> 
> Sometime in July James O'Kane assaulted the keyboard and produced:
> 
> | The difference I can tell is that ctrl-v works and ctrl-q doesn't. :)
> | At least from a bash shell in an xterm, which I think matter in some=20
> | manor.
> 
> that's weird. in konsole with 'declare -x TERM=3D"xterm"' they both work for
> me. you gotta love consistency.
> 
> 
> --=20
> --------------------------------------------------------------------------
>                                                | /"\
>  john harrold                                  | \ / ASCII ribbon campaign
>       jmh at member.fsf.org                    |  X  against HTML mail
>            the most useful idiot               | / \
> --------------------------------------------------------------------------
>  What difference does it make to the dead, the orphans, and the homeless,
>  whether the mad destruction is brought under the name of totalitarianism or
>  the holy name of liberty and democracy?
>  --Gandhi
> --------------------------------------------------------------------------
> gpg --keyserver keys.indymedia.org --recv-key F65A739E
> --------------------------------------------------------------------------
> 
> --5oH/S/bF6lOfqCQb
> Content-Type: application/pgp-signature
> Content-Disposition: inline
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.1 (GNU/Linux)
> 
> iD8DBQE/BFDJ78vw3vZac54RAvVHAKCgnF+YJ1ynlZJeqNP5x5hhjsBYJgCdHAO+
> XYZa8E5mxaeqySRp9wqQPEE=
> =onKb
> -----END PGP SIGNATURE-----
> 
> --5oH/S/bF6lOfqCQb--
> 
> --__--__--
> 
> Message: 25
> Date: Thu, 3 Jul 2003 11:56:59 -0400
> To: "'wplug at wplug.org'" <wplug at wplug.org>
> Subject: Re: [wplug] Stupid BASH Question
> From: "Eric C. Cooper" <ecc at cmu.edu>
> Reply-To: wplug at wplug.org
> 
> On Thu, Jul 03, 2003 at 10:50:34AM -0400, Wise, Jeremey wrote:
> > I thought the syntax was similar to the if [ ! -d /directory ] but a
> > -z .... apparently not:>) Man bash yield no clue... as I thought that is
> > where I got the -z idea.
> 
> "man test" is often quicker than wading through the bash man page.
> 
> $ which [
> /usr/bin/[
> $ ls -l /usr/bin/[
> lrwxrwxrwx    1 root     root            4 Jun 25 16:10 /usr/bin/[ -> test
> 
> (The [ ... ] logic is built into bash, but was external in the
> original Bourne sh.)



More information about the wplug mailing list