- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- sed and joining lines questions
Categories
Company
Local Language
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
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
Community
Resources
Forums
Blogs
- 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
03-25-2003 07:59 AM
03-25-2003 07:59 AM
I have a text file where I wish to join 3 consecutive lines into one line using sed.
The first line always has the following word (Commercial) as the first word of the line and I want to append the next two lines to create a single line.
I have been able to join two consecutive lines using sed but joining three lines has eluded me.
Any help, suggestions, examples would be greatly appreciated
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2003 08:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2003 09:05 AM
03-25-2003 09:05 AM
Re: sed and joining lines questions
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2003 09:15 AM
03-25-2003 09:15 AM
Re: sed and joining lines questions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2003 09:18 AM
03-25-2003 09:18 AM
Re: sed and joining lines questions
In answer to your question:
# echo `cat filename`
...or:
# xargs < filename
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2003 09:20 AM
03-25-2003 09:20 AM
Re: sed and joining lines questions
sed '/^Commercial/ N;s/\n/ /;N;s/\n/ /' filename
would be exactly what you are looking for.
- ramd.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2003 09:20 AM
03-25-2003 09:20 AM
Re: sed and joining lines questions
Worked like a charm.
Thanks for the quick response.
Can I assume the reply for Vitek is to another posting?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2003 09:22 AM
03-25-2003 09:22 AM
Re: sed and joining lines questions
The reply to Vitek was in answer to his query *within* this post. :-))
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2003 10:16 AM
03-25-2003 10:16 AM
Re: sed and joining lines questions
Thanks, but your solution adds extra spaces between the lines. Removing them may not be easy if original lines also contained spaces.
Scott,
I'm sorry for using your posting, I should have opened my own ...
Please do me a favor and assign 7 pts for James on my behalf.
Thank you.