HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Print file name problem
Operating System - HP-UX
1833871
Members
1656
Online
110063
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2004 11:07 AM
09-21-2004 11:07 AM
Could I use "lp" command to print out the file name in the paper.
For example: I want to print out /etc/hosts, the paper should have the hosts file information and the header that has "/etc/hosts". What option of "lp" command can be used or there is no method to do that?
--Simon
For example: I want to print out /etc/hosts, the paper should have the hosts file information and the header that has "/etc/hosts". What option of "lp" command can be used or there is no method to do that?
--Simon
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2004 11:44 AM
09-21-2004 11:44 AM
Re: Print file name problem
Nothing in lp except a separate 'banner' page which precedes the print job. However, you can use the pr command and pipe the result to lp:
pr /etc/hosts | lp
see the man page for lots of options.
Bill Hassell, sysadmin
pr /etc/hosts | lp
see the man page for lots of options.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2004 01:21 PM
09-21-2004 01:21 PM
Re: Print file name problem
Hi,
Thanks your answer.
If using "pr /etc/hosts | lp" that has some trouble because I may need to do it everytime if print another file.
Do you know there has or has no any script or deamon that may enable for it?
--Simon
Thanks your answer.
If using "pr /etc/hosts | lp" that has some trouble because I may need to do it everytime if print another file.
Do you know there has or has no any script or deamon that may enable for it?
--Simon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2004 01:55 PM
09-21-2004 01:55 PM
Solution
There is nothing in the lp spooler to do specialized formatting like pr. If you are good at shell scripting, you could modify each printer's script in /etc/lp/interface or /etc/lp/interface/model.orig (for HP JetDirect printers). Or create a script called prlp, something like this:
#!/usr/bin/sh
# pipe lp jobs through pr
if [ $# -lt 1 ]
then
echo "$0 requires a filename to print"
exit 1
fi
for PRINTJOB in $@
do
pr $PRINTJOB | lp
done
To sue this script, make it executable and do soemthing like this:
export LPDEST=myprinter
prlp /etc/hosts /etc/profile /etc/fstab
Now this is fairly simple--no options for pr and no options for lp. You can set the printer to use with LPDEST outside the script, or make the printer the first parameter and the printjob(s) the second parameter. Lots of possibilities, just look at the man page for pr.
Bill Hassell, sysadmin
#!/usr/bin/sh
# pipe lp jobs through pr
if [ $# -lt 1 ]
then
echo "$0 requires a filename to print"
exit 1
fi
for PRINTJOB in $@
do
pr $PRINTJOB | lp
done
To sue this script, make it executable and do soemthing like this:
export LPDEST=myprinter
prlp /etc/hosts /etc/profile /etc/fstab
Now this is fairly simple--no options for pr and no options for lp. You can set the printer to use with LPDEST outside the script, or make the printer the first parameter and the printjob(s) the second parameter. Lots of possibilities, just look at the man page for pr.
Bill Hassell, sysadmin
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP