- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Joining Text Files
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
10-24-2000 11:20 PM
10-24-2000 11:20 PM
I've tried using 'cat file1 file2 file3' but this adds newlines.
Dave Robertson
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2000 11:33 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2000 11:33 PM
10-24-2000 11:33 PM
Re: Joining Text Files
'cat' does not add newlines - my guess is that your NLs are already in the files.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2000 12:47 AM
10-25-2000 12:47 AM
Re: Joining Text Files
If I were sure about the redundant n in the last line of each file I'd simply send it through the stream editor (awk, perl, or whatever), like this
$ sed '$d' file1 file2 ... fileN > fileCatted
If unsure about the trailing n better use a regex to filter.
TIMTOWTDI as they would say in Perl-lingo.
But my feeling may be totally errant because I'm relatively new to Unix.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2000 12:50 AM
10-25-2000 12:50 AM
Re: Joining Text Files
Of course, substitute \n for n
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2000 12:50 AM
10-25-2000 12:50 AM
Re: Joining Text Files
Of course, substitute \n for n
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2000 12:51 AM
10-25-2000 12:51 AM
Re: Joining Text Files
Of course, substitute \n for n
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2000 12:52 AM
10-25-2000 12:52 AM
Re: Joining Text Files
Of course, substitute \n for n
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2000 01:14 AM
10-25-2000 01:14 AM
Re: Joining Text Files
See man pages for 'join'. Is this what you seek?
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2000 01:27 AM
10-25-2000 01:27 AM
Re: Joining Text Files
First, the annoying repetitive last posting was due to a webserver failure.
Second, one should first try things before giving advice. ;-)
Third, I think I misunderstood the issue.
If it was for chopping the trailing \n of each line (what the echo from above is doing on my machine) then you could use this Perl oneliner (even the obsolete Perl 4 shipped with HP-UX should do the trick)
$ perl -ne 'chop;print' file1 file2 ... fileN
But of course, this is also easily done using sed or awk.