Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!i2unix!inria!gouldfr!vogon!cetia!cetia1!mmm From: mmm@cetia1.cetia.fr (Mark Martin) Newsgroups: comp.windows.x Subject: Re: printing a selection from xterm Message-ID: <1767@cetia.cetia.fr> Date: 17 Dec 90 08:43:57 GMT Sender: news@cetia.cetia.fr Organization: CETIA, France Lines: 28 In article <696@lyman.pppl.gov> monticel@lyman.pppl.gov (Don Monticello) writes: >I'd like to be able to print the current selection in xterm. Here's a grotty little shell script I use. Not perfect, but cheap. ---------cut here------------- #!/bin/sh # return selected text. Mark Martin. cetia. france. # xprop returned format is (eg) CUT_BUFFER0 = "echo \"cetia\\\"\n" # get the \" and \\ and \n undone. sadly sed wont take long lines. # sed wont read input not ending in newline, so need to chop off final newline # use bell as newline marker. bell= xprop -root -notype CUT_BUFFER0 | sed '1s/[^=]*= "// s/\\n/'"$bell"'/g s/\\"/"/g s/\\\\/\\/g $s/"$//' | tr -d '\012' | tr $bell '\012' ----------------------------- Mark M Martin mmm@cetia.fr Cetia (BP 244), inria!cetia!mmm 150 rue Marcelin Berthelot, tel +33 94 08 80 00 ZI Toulon Est, fax +33 94 08 80 01 83078 TOULON CEDEX 9, France