Find the answer to your Linux question:
Results 1 to 2 of 2
Hi all, I have two files using grep i'm getting required output in "outputfile.txt" but i need to format it. Code: grep "$line" sampleMbr.txt >> outputfile.txt grep "$line" sampleMbrTerm.txt >> ...
  1. #1
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,568

    Post shell program + format the output

    Hi all,
    I have two files using grep i'm getting required output in "outputfile.txt" but i need to format it.


    Code:
    grep "$line" sampleMbr.txt >> outputfile.txt
    grep "$line" sampleMbrTerm.txt >> outputfile.txt

    Code:
    #cat outputfile.txt
    
    sometext1 
    sometext2
    sometext3

    but i want to output as


    Code:
    sometext1 sometext2 sometext3
    how to achieve this?
    - Lakshmipathi.G
    -------------------
    FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
    First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -------------------

  2. #2
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,568

    Post

    tr command works
    tr '\n' ' '
    - Lakshmipathi.G
    -------------------
    FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
    First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -------------------

Posting Permissions

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