Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!ames!pacbell!ditka!stb!michael From: michael@stb.UUCP (Michael) Newsgroups: comp.sources.d Subject: Re: Bourne Again Shell? Message-ID: <10659@stb.UUCP> Date: 10 Mar 89 20:36:35 GMT References: <26563@teknowledge-vaxc.ARPA> <46100006@hcx3> <1491@vicom.COM> <544@galaxia.Newport.RI.US> Reply-To: michael@stb.UUCP (Michael) Organization: STB BBS, La, Ca, Usa, +1 213 459 7231 Lines: 33 In article <544@galaxia.Newport.RI.US> dave@galaxia.Newport.RI.US (David H. Brierley) writes: >I would like to see a csh user show me how to achieve the following using >the csh history mechanism: retrieve the third previous command that contains >the string "foo" and then change the fourth word on the line to the word >"bar". In ksh: "/foonn3Wcwbar". Like I said, a knowledge of >vi is extremely helpful. >-- >David H. Brierley >Home: dave@galaxia.Newport.RI.US {rayssd,xanth,lazlo,jclyde}!galaxia!dave >Work: dhb@rayssd.ray.com {sun,decuac,gatech,necntc,ukma}!rayssd!dhb Ok. history | fgrep foo | tail -3 | head -1 !xyz:0-3 bar !xyz:5-$ Done. Readable. Now, my turn: How do you combine multiple commands in the KSH history mode? My copy of ksh does not implement vi's yank feature, so I cannot combine parts from command 32 with command 35. Also, ksh's vi mode has the /'s and ?'s backwards, as well as G (which goes to the first command, not the last command). (I know what you'll say, think of editing a file where the new lines go at the top. But then why can't I say 1G, and why are the numbers on the lines backwards?) Michael : --- : Michael Gersten uunet.uu.net!stb!michael : crash!gryphon!denwa!stb!michael : Its not the Coff that carries you off, its the coffin they carry you off in.