- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: printing
Categories
Company
Local Language
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- This widget could not be displayed.This widget could not be displayed.This widget could not be displayed.This widget could not be displayed.This widget could not be displayed.This widget could not be displayed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2003 11:25 AM
05-13-2003 11:25 AM
I want to print following lines
line1
line2
line3
as
line1 line2 line3.
I want to print in a single line instead of three lines.
Any help is appreciated.
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2003 11:45 AM
05-13-2003 11:45 AM
Re: printing
I assume the lines reside in a file. Thus:
# cat filename|xargs
If not, then consider:
# echo "line1\nline2\nline3"|xargs
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2003 11:48 AM
05-13-2003 11:48 AM
Solution#! /bin/sed -nf
H
$ {
x
s/\n//g
p
}
Example (script caled join.sed):
join.sed yourfile
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2003 01:51 PM
05-13-2003 01:51 PM
Re: printing
if it is just a matter of translating carriage return characters into spaces, tr is fast, e.g.:
# tr "\012" "\040" < linefile
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2003 02:44 PM
05-13-2003 02:44 PM
Re: printing
May I ask why it is not working if I don't use
H and x commands with s/\n//g?
Thanks a lot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2003 06:44 PM
05-13-2003 06:44 PM
Re: printing
cat file_name | paste - - -
(use - for each column needed)
pr -3 -t file_name
(in this case, each line is arranged vertically rather than horizontally)
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2003 04:41 AM
05-14-2003 04:41 AM
Re: printing
The x means - Exchange the contents of the pattern and hold spaces.
I don't know sed enough to explain it...
Here's a handy site:
http://www.unixguide.net/unix/sedoneliner.shtml
Rgds...Geoff