print number of lines and words in a single line with one spacing in shell scripting [closed]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












0















When I am using wc -lw filename, I am getting output separated into two spaces. But I want only one space separated. How to do this?










share|improve this question















closed as too broad by G-Man, msp9011, Anthony Geoghegan, Mr Shunz, Archemar Jan 22 at 14:53


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.













  • 7





    this sounds like an XY problem ..... you want help with what you consider to be a solution to an unknown problem, when in fact, you should be asking for help with the original problem .......... why do you need to have only one space between the output fields?

    – jsotola
    Jan 21 at 2:54















0















When I am using wc -lw filename, I am getting output separated into two spaces. But I want only one space separated. How to do this?










share|improve this question















closed as too broad by G-Man, msp9011, Anthony Geoghegan, Mr Shunz, Archemar Jan 22 at 14:53


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.













  • 7





    this sounds like an XY problem ..... you want help with what you consider to be a solution to an unknown problem, when in fact, you should be asking for help with the original problem .......... why do you need to have only one space between the output fields?

    – jsotola
    Jan 21 at 2:54













0












0








0








When I am using wc -lw filename, I am getting output separated into two spaces. But I want only one space separated. How to do this?










share|improve this question
















When I am using wc -lw filename, I am getting output separated into two spaces. But I want only one space separated. How to do this?







text-formatting wc






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 21 at 10:21









Jeff Schaller

41k1056131




41k1056131










asked Jan 21 at 2:41









PATTAPU VENKATA SANDEEPPATTAPU VENKATA SANDEEP

41




41




closed as too broad by G-Man, msp9011, Anthony Geoghegan, Mr Shunz, Archemar Jan 22 at 14:53


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









closed as too broad by G-Man, msp9011, Anthony Geoghegan, Mr Shunz, Archemar Jan 22 at 14:53


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









  • 7





    this sounds like an XY problem ..... you want help with what you consider to be a solution to an unknown problem, when in fact, you should be asking for help with the original problem .......... why do you need to have only one space between the output fields?

    – jsotola
    Jan 21 at 2:54












  • 7





    this sounds like an XY problem ..... you want help with what you consider to be a solution to an unknown problem, when in fact, you should be asking for help with the original problem .......... why do you need to have only one space between the output fields?

    – jsotola
    Jan 21 at 2:54







7




7





this sounds like an XY problem ..... you want help with what you consider to be a solution to an unknown problem, when in fact, you should be asking for help with the original problem .......... why do you need to have only one space between the output fields?

– jsotola
Jan 21 at 2:54





this sounds like an XY problem ..... you want help with what you consider to be a solution to an unknown problem, when in fact, you should be asking for help with the original problem .......... why do you need to have only one space between the output fields?

– jsotola
Jan 21 at 2:54










1 Answer
1






active

oldest

votes


















1














Use



echo $(wc -wl < filename)


or



echo $(wc -wl filename)


depending on whether you want the filename included. The $() will parse the output of the wc command into words separated by one or more spaces (or tabs). The effect for your case is that multiple spaces will be replaced by a single space.






share|improve this answer





























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Use



    echo $(wc -wl < filename)


    or



    echo $(wc -wl filename)


    depending on whether you want the filename included. The $() will parse the output of the wc command into words separated by one or more spaces (or tabs). The effect for your case is that multiple spaces will be replaced by a single space.






    share|improve this answer



























      1














      Use



      echo $(wc -wl < filename)


      or



      echo $(wc -wl filename)


      depending on whether you want the filename included. The $() will parse the output of the wc command into words separated by one or more spaces (or tabs). The effect for your case is that multiple spaces will be replaced by a single space.






      share|improve this answer

























        1












        1








        1







        Use



        echo $(wc -wl < filename)


        or



        echo $(wc -wl filename)


        depending on whether you want the filename included. The $() will parse the output of the wc command into words separated by one or more spaces (or tabs). The effect for your case is that multiple spaces will be replaced by a single space.






        share|improve this answer













        Use



        echo $(wc -wl < filename)


        or



        echo $(wc -wl filename)


        depending on whether you want the filename included. The $() will parse the output of the wc command into words separated by one or more spaces (or tabs). The effect for your case is that multiple spaces will be replaced by a single space.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 21 at 18:25









        RalfFriedlRalfFriedl

        5,4103925




        5,4103925












            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Displaying single band from multi-band raster using QGIS

            How many registers does an x86_64 CPU actually have?