Yahoo : Winternet : TC Guide  : Files of Local Interest Enter Sysinfo.com :

Subject: Re: escape key in vi
Subject: Re: escape key in vi
Subject: Re: escape key in vi
Subject: Re: escape key in vi
Subject: Re: NULL characters in vi
Subject: Re: Removing ">" from files.
Subject: Re: Removing ">" from files.
Subject: Re: Removing ">" from files.
Subject: Q: How to use $vars with the "ed" Editor?
Subject: Re: vi command question
Subject: Re: vi command question
Subject: Re: annoying characters in vi
Subject: Re: Removing control M's from files > ^M <




From: "J. Burmeister" <burmeister@fokus.gmd.de>
Newsgroups: comp.unix.programmer,comp.unix.shell,comp.unix,comp.unix.misc
Subject: Re: escape key in vi
Date: 19 Sep 1995 14:57:49 GMT
Lines: 20
Mime-Version: 1.0

At first, it's better to use ed (or `ex' in line mode) instead of a screen
oriented editor like vi within a shell script. And secondly, the vi provides
with ^V (Ctrl-V) to escape other control character.

Good luck,
   Jo"rg
-- 
-------------------------------------------------------------------------------
Jo"rg Burmeister
GMD FOKUS Berlin
Forschungszentrum Informationstechnik GmbH
Research Institute for Open Communication Systems

                  | Internet: burmeister@fokus.gmd.de
Hardenbergplatz 2 | X.400:    S=burmeister;OU=fokus;OU=berlin;P=gmd;A=d400;C=de
D - 10623 Berlin  | phone:    +49 30 25499 241
Germany           | fax:      +49 30 25499 202
                  | WWW:      http://www.fokus.gmd.de/htbin/info/burmeister
------------------+------------------------------------------------------------


--


From: dirk@hal.in-berlin.de (Dirk Froemberg)
Newsgroups: comp.unix.programmer,comp.unix.shell,comp.unix,comp.unix.misc
Subject: Re: escape key in vi
Date: 19 Sep 1995 23:10:45 +0200
Lines: 27

In <43lec7$ata@nova.umuc.edu> cm325b25@nova.umuc.edu (4062 Student 25) writes:

>Lo all!  I'm currently trying to write a shell script using the vi editor.
>The script itself will edit a file using vi, the editor I'm writing the
>script with.  A simplified sample:

>date > file		(creating file containing date)
>vi file			(editing file using vi)
>i text entered		(inserting new text)
>esc			(THE PROBLEM!!!)
>:x			(save and quit)

>How can I represent the escape key?  If I typed the esc key while editing
>the script, vi would simply take me out of insert mode.

Hi!

Try using ^V (CTRL-V) to escape ESC. Simplified: Press ^V ESC in
Edit Mode.

	Regards Dirk

-- 
e-mail: dirk@hal.in-berlin.de		PGP-Public-Key available

"Bomben, Rauschgift, Drogen, Anschlag, Erpressung, Mord, Raub,
Ueberfall, Waffen, Schutzgeld, Terror, Plutonium, Sprengstoff"

--


From: ebacon@oanet.com (Edmund Bacon)
Newsgroups: comp.unix.programmer,comp.unix.shell,comp.unix,comp.unix.misc
Subject: Re: escape key in vi
Date: Tue, 19 Sep 1995 23:58:56 GMT
Lines: 30


>Lo all!  I'm currently trying to write a shell script using the vi editor.
>The script itself will edit a file using vi, the editor I'm writing the
>script with.  A simplified sample:

>date > file		(creating file containing date)
>vi file			(editing file using vi)
>i text entered		(inserting new text)
>esc			(THE PROBLEM!!!)
>:x			(save and quit)

>How can I represent the escape key?  If I typed the esc key while editing
>the script, vi would simply take me out of insert mode.

>Thanks in advance for any suggestions,
>Sherwin

Use ^V to add the esc - you will see a ^ , which will turn into ^[
when you hit the esc key, and vi will treat it as a single character.
----------

  The Moving Finger writes; and, having writ
  Moves on: nor all thy Piety nor Wit
    Shall lure it back to cancel half a Line,
  Nor all thy Tears wash out a Word of it.
                           Rubaiyat  of Omar Khayyam


ebacon@oanet.com


--


From: jmoon@jrs.com (Jong Moon)
Newsgroups: comp.unix.programmer,comp.unix.shell,comp.unix,comp.unix.misc
Subject: Re: escape key in vi
Date: 20 Sep 1995 18:32:52 -0700
Lines: 35

In article <43lec7$ata@nova.umuc.edu>,
4062 Student 25 <cm325b25@nova.umuc.edu> wrote:
>
>Lo all!  I'm currently trying to write a shell script using the vi editor.
>The script itself will edit a file using vi, the editor I'm writing the
>script with.  A simplified sample:
>
>date > file		(creating file containing date)
>vi file			(editing file using vi)
>i text entered		(inserting new text)
>esc			(THE PROBLEM!!!)
>:x			(save and quit)
>
>How can I represent the escape key?  If I typed the esc key while editing
>the script, vi would simply take me out of insert mode.

Why not use ed instead of vi?

Something like:

#!/bin/sh
touch file
ed - file << END
r !date
1i
text entered


From: susanc@news.SanDiegoCA.ATTGIS.COM (susan cassidy)
Newsgroups: comp.unix.questions
Subject: Re: NULL characters in vi
Date: 28 Feb 1996 01:26:56 -0800
Lines: 69

In article <4gv00l$g9b@maverick.tad.eds.com>,
Fredrik Wennberg <lo1be.fwennb01@eds.com> wrote:
>richk@panix.com (Rich Kus) wrote:
>
>>>How do I put a NULL character (octal 000) in one of my ASCII files
>>>using standard UNIX commands, since "vi" isn't capable of editing  ^@
>>>(NULL) and ^J (LF) characters. I am currently using OSF/1 v3.0.
>>>
>
>> you can insert control-characters in vi.
>> when in insert mode type ^v then ^@.
>
>Nope, that didn't do the job. Vi is still not capable of inserting
>NULL (^@) characters. 
>
>[START: From "An Introduction to Display with Vi"]
>
>The implemantation of the editor does not allow the NULL (^@)
>character to appear in files.
>
>[END: "From An Introduction to Display with Vi"]
>
>I need some other trick to do the job.
>
>//Fredrik Wennberg		EDS Sweden AB
>				lo1be.fwennb01@eds.com
>

You can use dd to cut the file into two pieces, use echo to create a
temporary file with a null character in it, then cat the three files
back together, e.g.:

ssd3450_root> hd testit
0000    74 65 73 74 20 64 61 74  61 20 30 31 32 33 34 35   test data 012345
0010    36 37 38 39 30 20 54 45  53 54 20 44 41 54 41      67890 TEST DATA
001f
ssd3450_root> dd if=testit of=test1 bs=15 count=1
1+0 records in
1+0 records out
ssd3450_root> ssd3450_root> dd if=testit of=test2 bs=15 skip=1
1+1 records in
1+1 records out
ssd3450_root> hd test1
0000    74 65 73 74 20 64 61 74  61 20 30 31 32 33 34      test data 01234
000f
ssd3450_root> hd test2
0000    35 36 37 38 39 30 20 54  45 53 54 20 44 41 54 41   567890 TEST DATA
0010
ssd3450_root> 
ssd3450_root> echo "\000" >temp1
ssd3450_root> dd if=temp1 of=temp2 bs=1 count=1
1+0 records in
1+0 records out
ssd3450_root> hd temp2
0000    00                                                 .
0001
ssd3450_root> cat test1 temp2 test2 >> testout
ssd3450_root> hd testout
0000    74 65 73 74 20 64 61 74  61 20 30 31 32 33 34 00   test data 01234.
0010    35 36 37 38 39 30 20 54  45 53 54 20 44 41 54 41   567890 TEST DATA
0020

I had to use dd to cut the line feed off of the end of the temp1 file
because my /usr/ucb/echo -n does not seem to do octal output correctly.

I know this is kludge-y, but it works.  There may be a better way.
-- 
Susan Cassidy
email: susan.cassidy@sandiegoca.attgis.com

--


From: cain@pinn.net (James Cain)
Newsgroups: comp.unix.questions
Subject: Re: Removing ">" from files.
Date: 28 Feb 1996 20:51:22 GMT
Lines: 31

Jason R. Heminger (ching@wpi.edu) wrote:
: I was wondering if there was an easy way to remove the >'s from the beginning
: of lines from forwarded mail through emacs or sed or whathave you.  I checked
: the FAQ to no avail.

: Thanks!

Sure, one method in vi (sorry) command (or movement, whatever) mode, enter

:1,$s/^>//         ...where, reading from the bottom
^^ ^^ ^^ ^
|| || |  |
|| || |  |___with nothing (empty //)
|| || |___which is beginning of line (^) and >
|| ||___substitue (stuff enclosed in //)
|| |___to last line of file
||__from first line of file
|__(esc, first, then) : puts you at command line

You may want to substitue "/^> /" (notice space after >) for the string to
be substituted.  If I recall there is a space after the > in reply mail.
Otherwise the result will be indented one space.

Hope it helps...jc

--
/\/\---------------------------------------------------------      o 
>     James Cain                    /  Good - Cheap - Fast  |     8  __ 
> eMail: cain@pinn.net             /       Pick any two!    |    _i_|[]|
> aka: cain@prc.prc.mrms.navy.mil /#include <std.disclaimer>|\__|______|
\/\/---------------------------------------------------------/-(o_o_o_o)

--


From: mcclellantj@harrier (Tad McClellan)
Newsgroups: comp.unix.questions
Subject: Re: Removing ">" from files.
Date: 28 Feb 1996 21:03:37 GMT
Lines: 22
Reply-To: mcclellantj@lfwc.lockheed.com

Jason R. Heminger (ching@wpi.edu) wrote:
: I was wondering if there was an easy way to remove the >'s from the beginning
: of lines from forwarded mail through emacs or sed or whathave you.  I checked
: the FAQ to no avail.


in vi:
:%s/^>//

with sed:
sed -e 's/^>//' <withem >withoutem

with perl:
perl -p -i -e 's/^>//;' filename

with tr:
tr -d '>' '' <withem >withoutem

--
  Tad McClellan,      Logistics Specialist (IETMs and SGML guy)
                      email: mcclellantj@lfwc.lockheed.com
  All I want, is a little more than I'll ever get.

--

From dufresne@darkstar.sysinfo.comTue Mar  5 02:29:54 1996
Date: Thu, 29 Feb 1996 02:22:00 -0600 (CST)
From: "R. DuFresne" <dufresne@darkstar.sysinfo.com>
To: mcclellantj@lfwc.lockheed.com

> From: mcclellantj@harrier (Tad McClellan)
> Newsgroups: comp.unix.questions
> Subject: Re: Removing ">" from files.
> Date: 28 Feb 1996 21:03:37 GMT
> Lines: 22
> Reply-To: mcclellantj@lfwc.lockheed.com
> 
> Jason R. Heminger (ching@wpi.edu) wrote:
> : I was wondering if there was an easy way to remove the >'s from the beginning
> : of lines from forwarded mail through emacs or sed or whathave you.  I checked
> : the FAQ to no avail.
> 
> 
> in vi:
> :%s/^>//
> 
> with sed:
> sed -e 's/^>//' <withem >withoutem
> 
> with perl:
> perl -p -i -e 's/^>//;' filename
> 
> with tr:
> tr -d '>' '' <withem >withoutem


filename: test

> access to the ether, And then use the Networking Monitoring tool to track
> packets.  It's a very nice interface - dumps all the info to an available
> SQL Server, including packet contents.  It tracks statistics based on MAC
> addresses if I remember right though, but it does include a vendor database

darkstar:~$ tr -d '>' '' < test > test.tr3
tr: only one string may be given when deleting without squeezing repeats
darkstar:~$
darkstar:~$ more test.tr3
darkstar:~$

darkstar:~$ tr -d ">' '" < test > test.tr
darkstar:~$
darkstar:~$ more test.tr
access to the ether, And then use the Networking Monitoring tool to track
 packets.  It's a very nice interface - dumps all the info to an available
 SQL Server, including packet contents.  It tracks statistics based on MAC
 addresses if I remember right though, but it does include a vendor database


darkstar:~$ tr -d -s '>' '' < test > test.tr2
darkstar:~$
darkstar:~$ more test.tr2
access to the ether, And then use the Networking Monitoring tool to track
 packets.  It's a very nice interface - dumps all the info to an available
 SQL Server, including packet contents.  It tracks statistics based on MAC
 addresses if I remember right though, but it does include a vendor database




> 
> --
>   Tad McClellan,      Logistics Specialist (IETMs and SGML guy)
>                       email: mcclellantj@lfwc.lockheed.com
>   All I want, is a little more than I'll ever get.


Ron DuFresne



From: dojo@bnr.ca (Don Gauthier)
Newsgroups: comp.unix.misc,comp.unix.questions
Subject: Q: How to use $vars with the "ed" Editor?
Date: 28 Feb 1996 19:12:37 GMT
Lines: 34


**************************************
**************************************

ed submit_spectra_test >&/dev/null <<'END_OF_FILE'
/bld_nras
g?bld_nras[0-9]?s??$BLD_NRAS_VAR?g
w
q
'END_OF_FILE'

**************************************
**************************************

 ex ../config/spectra.tools  <<! >/dev/null
set magic
set noic
s/bld_nras[0-9]/$BLD_NRAS_VAR/g
w
q
!
       
**************************************
**************************************

The above sections don't work for me. Does anyone out there have any
solutions on the substitute expansion of the $BLD_NRAS_VAR within the ed 
"here" doc/script OR the ex "here" doc/script?


Thx,

e-mail replies to dojo@bnr.ca


--

Yahoo : Winternet : TC Guide  : Files of Local Interest Enter Sysinfo.com :




From: ken@halcyon.com (Ken Pizzini)
Newsgroups: comp.unix.questions
Subject: Re: vi command question
Date: 17 Mar 1999 21:45:54 GMT
Lines: 17
Reply-To: ken@halcyon.com
User-Agent: slrn/0.9.5.3 (UNIX)

On Wed, 17 Mar 1999 09:46:33 -0800, Robert Annandale <rob_a@unipharm.com> wrote:
>Nevermind, the brain kicked in right after I pressed SEND
>I was not placing backslashes before the metacharacters.
>
>g/\/usr\/support\/yard\//s//\/usr\/support\/common\/progs\//g
>
>was what I was supposed to type in.

You're going about it the hard way:
 g,/usr/support/yard/,s,,/usr/support/common/progs/,g
or perhaps:
 %s,/usr/support/yard/,/usr/support/common/progs/,g

Yes, \/ is one approach that works, but it is often easier
to just use a different delimiter.

		--Ken Pizzini

-- 


From: Barry Margolin <barmar@bbnplanet.com>
Newsgroups: comp.unix.questions
Subject: Re: vi command question
Originator: barmar@bbnplanet.com (Barry Margolin)
Lines: 27
Distribution: world
Date: Fri, 19 Mar 1999 07:07:32 GMT

In article <36F1DE6A.97B5A2EB@earthlink.net>,
Atul Pinge  <atulmanisha@earthlink.net> wrote:
>Hello,
>
>1.  In global substitutions of paths it might be a good idea to replace '/' in
>substitution command with a new character say ":" or a ".".  So the command
>will look like
>
>%s:/usr/support/yard:/usr/support/common/prog:g
>
>OR
>
>%s./usr/support/yard./usr/support/common/prog.g
>
>This has definitely worked on the UNICES I've worked on.  But I'm not sure if
>it is standard.

It's extremely standard, and probably predates Unix.  I wouldn't use '.',
though, since it would make it difficult to use '.' as a metacharacter in
the pattern.  I usually use ',', since it has no special meaning in regular
expressions, and it can be typed without shifting.

-- 
Barry Margolin, barmar@bbnplanet.com
GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

-- 


From: Roger@localhost
Newsgroups: comp.unix.questions
Subject: Re: annoying characters in vi
Date: Tue, 23 Mar 1999 18:48:59 GMT
Lines: 14

On Mon, 22 Mar 1999 08:33:28 +1200, "Jeremy Sherriff"
<jeremys@ticketek.co.nz> wrote:

>The easiest solution is to not edit the files on a non-unix platform.

PFE (Programmer's File Editor) for Windows is quite happy with
newline only files. It doesn't convert them to CR-LF
automatically, but will if that is what you want. The price?
Free. Excellent value.

    http://www.lancs.ac.uk/people/cpaap/pfe

-- 
Roger

-- 


From: "Eric G." <gravelle@foursixteen.com>
Newsgroups: alt.unix.wizards
Subject: Re: Removing control M's from files > ^M <
Date: Mon, 19 Apr 1999 15:01:03 -0400
Lines: 21
Mime-Version: 1.0

Using tr, here's another method to remove those beutiful ^M from dos
files...

tr -d "\015" < filename1 > filename2

Enjoy!

Bob Withers wrote:
> 
> In article <PEhfUAArnGC3Ew0K@admit.com>, administrator@admit.com says...
> > Try
> >
> >         man dos2ux
> 
> For a more general solution to this try my cvt utility.  It does the
> conversion using wildcards and will recurse down a directory tree.  You
> can pick it up, source included, at
> http://www.ticnet.com/bwit/download.htm.
> 
> Regards,
> Bob

-- 

Yahoo : Winternet : TC Guide  : Files of Local Interest Enter Sysinfo.com :



Hosted by: Enter:  sysinfo.com


©copyright 1995-2002 sysinfo.com