Find the answer to your Linux question:
Results 1 to 3 of 3
Hello, i have a problem and need your help i have a text file generated automatically from a script , but the result in the script is not ordered in ...
  1. #1
    Just Joined!
    Join Date
    Mar 2011
    Posts
    2

    triming lines using shell command

    Hello,

    i have a problem and need your help

    i have a text file generated automatically from a script , but the result in the script is not ordered in a readable way, so i need your help to fix it using a shell command

    the text file contain data in this way :


    Code:
        0.147361 0.243688 0.081520 -0.446603 1.130529 NC_000846 Chordata
        Rheiformes
        Aves
         
        0.091740 0.379224 0.021160 -0.088493 3.441356 NC_000857 Arthropoda
        Diptera
        Insecta
         
        0.169093 0.265700 0.030083 -0.262037 1.211815 NC_000860 Chordata
        Salmoniformes
        Actinopterygii


    i want to arrange the data in this text file in a way that each line will concatenate the 2 lines after it , so that will be 1 line , i want all the lines to be treated in this way ,

    is there any way to do this ?



    thanks in advance

  2. #2
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,230
    This sounds a bit like a homework problem, but I'll give you a hint.

    Do you know how to read in a line? Do you know how to output a line? These are both very easy with Bash scripting.

    It seems to me that it would be very easy to read in three lines, and then output them concatenated together.
    DISTRO=Arch
    Registered Linux User #388732

  3. #3
    Just Joined!
    Join Date
    Mar 2011
    Posts
    2
    Hello,

    first, thank you for you reply ,

    i do know how to read a line , and how to output a line , i just learned this ,

    but reading three line through all the txt file and then concatenate them , and how to count how much lines ?

    i don't know how to do this , so please give me some code hints to start with

    thanks in advance

Posting Permissions

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