Find the answer to your Linux question:
Results 1 to 4 of 4
Hi, I have two files a.txt and b.txt. a.txt content: 919199991919 b.txt content: 926252525552 What i am getting is by shooting----- #cat a.txt b.txt >> c.txt: 919199991919926252525552 Desired output in ...
  1. #1
    Just Joined!
    Join Date
    Nov 2010
    Posts
    2

    Thumbs down Files Concatenation

    Hi,

    I have two files a.txt and b.txt.

    a.txt content:
    919199991919

    b.txt content:
    926252525552

    What i am getting is by shooting----- #cat a.txt b.txt >> c.txt:
    919199991919926252525552

    Desired output in c.txt the second number should be in new line:

    919199991919
    926252525552

    Please help!
    Thanks in advance..

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Well, if a.txt is not new-line terminated, then what you get is what you got! What you need to do is either to fix up the file(s) so that they have a proper new-line (line-feed in Linux/Unix systems), or create an intermediate file that has such, and then do "cat a.txt nl.txt b.txt" where nl.txt is a file with JUST a new-line in it. That should work for you.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Nov 2010
    Posts
    2
    Thanks Superman....

  4. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    I'd change my online handle, but DC Comics may complain about trademark infringement!
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...