This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Building Blockchain Apps and have Michael Yuan on-line!
See this thread for details.
Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

unix

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do i concatenate file1 and file2 in a new file called" result" with a blank line between the data of two files?
cat file1 file2 >> result
I dont know how ot get the blank line
 
Marshal
Posts: 68142
258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please always let the subject line tell us what the threa‍d is about.
What happens if you interpose '\n' between the two file names?
 
Bartender
Posts: 21766
148
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:What happens if you interpose '\n' between the two file names?



Nothing good.

But how about this?


The pair of double-quotes on the "echo" statement shouldn't be essential. But it does accent the fact that you're interjecting a bare line into the pipe where "-" in the cat command can pick it up.

And just in case there's confusion, I should point out that ">>result" appends all of the about to whatever was already in result. If you wanted result to be only the two files with intervening line, then you'd use ">", not ">>".
 
That's my roommate. He's kinda weird, but he always pays his half of the rent. And he gave me this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!