From owner-freebsd-questions Fri Mar 10 9:42: 7 2000 Delivered-To: freebsd-questions@freebsd.org Received: from mail.ptd.net (mail2.ha-net.ptd.net [207.44.96.66]) by hub.freebsd.org (Postfix) with SMTP id 6F0E937BA52 for ; Fri, 10 Mar 2000 09:42:04 -0800 (PST) (envelope-from tms2@mail.ptd.net) Received: (qmail 2820 invoked from network); 10 Mar 2000 17:42:07 -0000 Received: from du70.cli.ptd.net (HELO mail.ptd.net) (204.186.33.70) by mail.ptd.net with SMTP; 10 Mar 2000 17:42:07 -0000 Message-ID: <38C9332B.C1AD312@mail.ptd.net> Date: Fri, 10 Mar 2000 12:38:51 -0500 From: "Thomas M. Sommers" X-Mailer: Mozilla 4.51 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 To: freebsd-questions@FreeBSD.org Subject: Re: truncating lines with a script... References: <934E0337010C01E0@smtp-gate.mottmac.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Jonathan Wall wrote: > > Hi there, > > Hopefully somebody can spare a moment to solve a problem I'm having... > > I have a very simple sh script that runs 'ps' via rsh for some machines on > our network and then pipes the output through grep to pick out the lines of > interest - in this case the Xvnc processes. I would like to then pipe the > output through another command to remove the superfluous Xvnc command line > switches the ps command also shows. > > The script as it currently stands is shown below. I thought sed would be > the answer but apart from having an astoundingly cryptic man page, I think > it can only delete whole lines containing a particular string rather than a > segment of a line. I know I could have used 'comm' instead of 'command' in > the script to have a shortened output from ps, but then I can't see which > screen the Xvnc processes are attached to. The typical output is below the > script and given this example I would ideally like to remove everything > after the ':1'. Perhaps I should be using awk or perl ??? > > I'm frustrated to be unable to work this out for myself since it seems so > trivial. Is there a correspondingly trivial solution ?? > > Thanks in advance to anyone who has time to write a reply, > > Jonathan Wall. man cut To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message