OT: scripting, removing trailing ^L

Bill Campbell bill at celestial.com
Fri Dec 23 11:43:34 PST 2005


On Fri, Dec 23, 2005, Jim Asman wrote:
>--------------- Original Message ---------------
>> At 12:00P Fri Dec 23 2005, Bob Stockler wrote:
>
>> William James McEachran wrote (on Fri, Dec 23, 2005 at 11:19:16AM -0500):
>> 
>> | Slightly off-topic.
>> | The data comes from filePro, some of it passes thru 'gnuplot', and in
>> | the end the gnuplot graph is incorporated into the filepro output form.
>> | The whole thing then is converted with 'pcl6'/ghostpcl into a PDF file
>> | Result, a PDF file with data & a graph.
>> | 
>> | gnuplot adds an unneed "^L" to the end of the graph pcl file. I've got
>> | to come up with a way to remove just this one character at the end of the
>> | file.  I've got a mental block on removing just the final character.
>> | 
>> | sed? awk?
>> 
>> How about tr?
>> 
>>   tr -d '\014' <file1 >file2
>> 
>> 
>Well, we don't know if a ^L can exist legitimately elsewhere in the
>file. Certainly, any raster images could contain ^L's. So a blanket
>removal of all such characters may not be appropriate.

This may work as well to delete the last line of the file running
the ex editor in place to delete the last line

ex - filename <<DONE
$d
wq
DONE

Bill
--
INTERNET:   bill at Celestial.COM  Bill Campbell; Celestial Systems, Inc.
UUCP:               camco!bill  PO Box 820; 6641 E. Mercer Way
FAX:            (206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676
URL: http://www.celestial.com/

``It is surprising how much new stuff users find that developers never do.
You put a copy in front of a normal user and they find all these bugs that
you would think developers would find. The real users and developers are
completely different species as far as I am concerned.''
    --Linux creator Linus Torvalds


More information about the Filepro-list mailing list