How to use bash cat * to wrap? [duplicate]

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












0
















This question already has an answer here:



  • Force newlines with cat wildcard printing

    6 answers



  • How can I wrap text at a certain column size?

    6 answers



ls /proc/
1 10984 11246 131 144 167 2099 31788 4805 5375 6762 7594 8111 8722 consoles
10 10993 11247 1314 14400 168 21 32 4807 5379 6771 76 8112 8738 cpuinfo
100 10998 11248 13163 14403 169 210 32408 4818 5386 6788 7601 8113 8752 crypto
101 11 11249 132 14404 17 211 33 4831 5388 68 7619 8114 8768 devices
102 110 11251 133 14405 170 2111 34 4833 54 6808 7625 8115 8789 diskstats
10202 11012 11252 134 14406 1726 2115 3489 4846 5417 6827 7626 8116 88 dma


cat /proc/10993/root/run_command
/usr/sbin/libvirtd --listen(nova-libvirt)


and I want to get all PID run_command



cd /proc
cat */root/run_command
/etc/barbican/vassals --logto /var/log/kolla/barbican/barbican-api.loguwsgi --master --emperor /etc/barbican/vassals --logto /var/log/kolla/barbican/barbican-api.loguwsgi --master --emperor /etc/barbican/vassals --logto /var/log/kolla/barbican/barbican-api.log/opt/kibana/bin/kibanabarbican-keystone-listenerbarbican-keystone-listenerheat-api-cfnheat-api-cfnneutron-dhcp-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/dhcp_agent.inimistral-server --server executor --config-file /etc/mistral/mistral.confneutron-dhcp-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/dhcp_agent.inimistral-server --server executor --config-file /etc/mistral/mistral.conf/usr/sbin/sshd -Dtacker-server --config-file /etc/tacker/tacker.conf/usr/sbin/sshd -Dtacker-server --config-file /etc/tacker/tacker.conf/usr/sbin/apache2/usr/sbin/td-agent/usr/bin/mysqld_safeglance-registry/usr/sbin/apache2start-ovsdb-server 127.0.0.1/usr/bin/mysqld_safeglance-registrynova-apistart-ovsdb-server 127.0.0.1nova-consoleauthnova-api/usr/sbin/libvirtd --listennova-consoleauth/usr/bin/memcached -v -l 10.60.6.174 -p 11211 -c 5000 -U 0/usr/bin/memcached -v -l 10.60.6.174 -p 11211 -c 5000 -U 0/usr/sbin/libvirtd --listenneutron-metadata-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/metadata_agent.ini/usr/sbin/libvirtd --listenmistral-server --server engine --config-file /etc/mistral/mistral.confneutron-metadata-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/metadata_agent.inimistral-server --server engine --config-file /etc/mistral/mistral.confstart-ovsdb-server 127.0.0.1/usr/share/elasticsearch/bin/elasticsearchsleep infinity/usr/share/elasticsearch/bin/elasticsearchbarbican-workersleep infinitynova-conductorbarbican-worker/opt/kafka/bin/kafka-server-start.sh /etc/kafka/kafka.server.propertiesnova-compute/usr/sbin/libvirtd --listen/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2no ...


but it's too messy to read.
How do I put each record (content of each file) on a separate line?



run_comand_content1
run_comand_content2
run_comand_content3


or



run_comand_content1

run_comand_content2

run_comand_content3









share|improve this question















marked as duplicate by Sparhawk, G-Man, Mr Shunz, Christopher, roaima Jan 22 at 16:48


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.













  • 1





    Can do wrap? is not a very clear description of how the output should look .... a simple wrap is also "messy"

    – jsotola
    Jan 22 at 2:22












  • sorry, I add the description.

    – bohan Chen
    Jan 22 at 3:29















0
















This question already has an answer here:



  • Force newlines with cat wildcard printing

    6 answers



  • How can I wrap text at a certain column size?

    6 answers



ls /proc/
1 10984 11246 131 144 167 2099 31788 4805 5375 6762 7594 8111 8722 consoles
10 10993 11247 1314 14400 168 21 32 4807 5379 6771 76 8112 8738 cpuinfo
100 10998 11248 13163 14403 169 210 32408 4818 5386 6788 7601 8113 8752 crypto
101 11 11249 132 14404 17 211 33 4831 5388 68 7619 8114 8768 devices
102 110 11251 133 14405 170 2111 34 4833 54 6808 7625 8115 8789 diskstats
10202 11012 11252 134 14406 1726 2115 3489 4846 5417 6827 7626 8116 88 dma


cat /proc/10993/root/run_command
/usr/sbin/libvirtd --listen(nova-libvirt)


and I want to get all PID run_command



cd /proc
cat */root/run_command
/etc/barbican/vassals --logto /var/log/kolla/barbican/barbican-api.loguwsgi --master --emperor /etc/barbican/vassals --logto /var/log/kolla/barbican/barbican-api.loguwsgi --master --emperor /etc/barbican/vassals --logto /var/log/kolla/barbican/barbican-api.log/opt/kibana/bin/kibanabarbican-keystone-listenerbarbican-keystone-listenerheat-api-cfnheat-api-cfnneutron-dhcp-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/dhcp_agent.inimistral-server --server executor --config-file /etc/mistral/mistral.confneutron-dhcp-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/dhcp_agent.inimistral-server --server executor --config-file /etc/mistral/mistral.conf/usr/sbin/sshd -Dtacker-server --config-file /etc/tacker/tacker.conf/usr/sbin/sshd -Dtacker-server --config-file /etc/tacker/tacker.conf/usr/sbin/apache2/usr/sbin/td-agent/usr/bin/mysqld_safeglance-registry/usr/sbin/apache2start-ovsdb-server 127.0.0.1/usr/bin/mysqld_safeglance-registrynova-apistart-ovsdb-server 127.0.0.1nova-consoleauthnova-api/usr/sbin/libvirtd --listennova-consoleauth/usr/bin/memcached -v -l 10.60.6.174 -p 11211 -c 5000 -U 0/usr/bin/memcached -v -l 10.60.6.174 -p 11211 -c 5000 -U 0/usr/sbin/libvirtd --listenneutron-metadata-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/metadata_agent.ini/usr/sbin/libvirtd --listenmistral-server --server engine --config-file /etc/mistral/mistral.confneutron-metadata-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/metadata_agent.inimistral-server --server engine --config-file /etc/mistral/mistral.confstart-ovsdb-server 127.0.0.1/usr/share/elasticsearch/bin/elasticsearchsleep infinity/usr/share/elasticsearch/bin/elasticsearchbarbican-workersleep infinitynova-conductorbarbican-worker/opt/kafka/bin/kafka-server-start.sh /etc/kafka/kafka.server.propertiesnova-compute/usr/sbin/libvirtd --listen/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2no ...


but it's too messy to read.
How do I put each record (content of each file) on a separate line?



run_comand_content1
run_comand_content2
run_comand_content3


or



run_comand_content1

run_comand_content2

run_comand_content3









share|improve this question















marked as duplicate by Sparhawk, G-Man, Mr Shunz, Christopher, roaima Jan 22 at 16:48


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.













  • 1





    Can do wrap? is not a very clear description of how the output should look .... a simple wrap is also "messy"

    – jsotola
    Jan 22 at 2:22












  • sorry, I add the description.

    – bohan Chen
    Jan 22 at 3:29













0












0








0









This question already has an answer here:



  • Force newlines with cat wildcard printing

    6 answers



  • How can I wrap text at a certain column size?

    6 answers



ls /proc/
1 10984 11246 131 144 167 2099 31788 4805 5375 6762 7594 8111 8722 consoles
10 10993 11247 1314 14400 168 21 32 4807 5379 6771 76 8112 8738 cpuinfo
100 10998 11248 13163 14403 169 210 32408 4818 5386 6788 7601 8113 8752 crypto
101 11 11249 132 14404 17 211 33 4831 5388 68 7619 8114 8768 devices
102 110 11251 133 14405 170 2111 34 4833 54 6808 7625 8115 8789 diskstats
10202 11012 11252 134 14406 1726 2115 3489 4846 5417 6827 7626 8116 88 dma


cat /proc/10993/root/run_command
/usr/sbin/libvirtd --listen(nova-libvirt)


and I want to get all PID run_command



cd /proc
cat */root/run_command
/etc/barbican/vassals --logto /var/log/kolla/barbican/barbican-api.loguwsgi --master --emperor /etc/barbican/vassals --logto /var/log/kolla/barbican/barbican-api.loguwsgi --master --emperor /etc/barbican/vassals --logto /var/log/kolla/barbican/barbican-api.log/opt/kibana/bin/kibanabarbican-keystone-listenerbarbican-keystone-listenerheat-api-cfnheat-api-cfnneutron-dhcp-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/dhcp_agent.inimistral-server --server executor --config-file /etc/mistral/mistral.confneutron-dhcp-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/dhcp_agent.inimistral-server --server executor --config-file /etc/mistral/mistral.conf/usr/sbin/sshd -Dtacker-server --config-file /etc/tacker/tacker.conf/usr/sbin/sshd -Dtacker-server --config-file /etc/tacker/tacker.conf/usr/sbin/apache2/usr/sbin/td-agent/usr/bin/mysqld_safeglance-registry/usr/sbin/apache2start-ovsdb-server 127.0.0.1/usr/bin/mysqld_safeglance-registrynova-apistart-ovsdb-server 127.0.0.1nova-consoleauthnova-api/usr/sbin/libvirtd --listennova-consoleauth/usr/bin/memcached -v -l 10.60.6.174 -p 11211 -c 5000 -U 0/usr/bin/memcached -v -l 10.60.6.174 -p 11211 -c 5000 -U 0/usr/sbin/libvirtd --listenneutron-metadata-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/metadata_agent.ini/usr/sbin/libvirtd --listenmistral-server --server engine --config-file /etc/mistral/mistral.confneutron-metadata-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/metadata_agent.inimistral-server --server engine --config-file /etc/mistral/mistral.confstart-ovsdb-server 127.0.0.1/usr/share/elasticsearch/bin/elasticsearchsleep infinity/usr/share/elasticsearch/bin/elasticsearchbarbican-workersleep infinitynova-conductorbarbican-worker/opt/kafka/bin/kafka-server-start.sh /etc/kafka/kafka.server.propertiesnova-compute/usr/sbin/libvirtd --listen/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2no ...


but it's too messy to read.
How do I put each record (content of each file) on a separate line?



run_comand_content1
run_comand_content2
run_comand_content3


or



run_comand_content1

run_comand_content2

run_comand_content3









share|improve this question

















This question already has an answer here:



  • Force newlines with cat wildcard printing

    6 answers



  • How can I wrap text at a certain column size?

    6 answers



ls /proc/
1 10984 11246 131 144 167 2099 31788 4805 5375 6762 7594 8111 8722 consoles
10 10993 11247 1314 14400 168 21 32 4807 5379 6771 76 8112 8738 cpuinfo
100 10998 11248 13163 14403 169 210 32408 4818 5386 6788 7601 8113 8752 crypto
101 11 11249 132 14404 17 211 33 4831 5388 68 7619 8114 8768 devices
102 110 11251 133 14405 170 2111 34 4833 54 6808 7625 8115 8789 diskstats
10202 11012 11252 134 14406 1726 2115 3489 4846 5417 6827 7626 8116 88 dma


cat /proc/10993/root/run_command
/usr/sbin/libvirtd --listen(nova-libvirt)


and I want to get all PID run_command



cd /proc
cat */root/run_command
/etc/barbican/vassals --logto /var/log/kolla/barbican/barbican-api.loguwsgi --master --emperor /etc/barbican/vassals --logto /var/log/kolla/barbican/barbican-api.loguwsgi --master --emperor /etc/barbican/vassals --logto /var/log/kolla/barbican/barbican-api.log/opt/kibana/bin/kibanabarbican-keystone-listenerbarbican-keystone-listenerheat-api-cfnheat-api-cfnneutron-dhcp-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/dhcp_agent.inimistral-server --server executor --config-file /etc/mistral/mistral.confneutron-dhcp-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/dhcp_agent.inimistral-server --server executor --config-file /etc/mistral/mistral.conf/usr/sbin/sshd -Dtacker-server --config-file /etc/tacker/tacker.conf/usr/sbin/sshd -Dtacker-server --config-file /etc/tacker/tacker.conf/usr/sbin/apache2/usr/sbin/td-agent/usr/bin/mysqld_safeglance-registry/usr/sbin/apache2start-ovsdb-server 127.0.0.1/usr/bin/mysqld_safeglance-registrynova-apistart-ovsdb-server 127.0.0.1nova-consoleauthnova-api/usr/sbin/libvirtd --listennova-consoleauth/usr/bin/memcached -v -l 10.60.6.174 -p 11211 -c 5000 -U 0/usr/bin/memcached -v -l 10.60.6.174 -p 11211 -c 5000 -U 0/usr/sbin/libvirtd --listenneutron-metadata-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/metadata_agent.ini/usr/sbin/libvirtd --listenmistral-server --server engine --config-file /etc/mistral/mistral.confneutron-metadata-agent --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/metadata_agent.inimistral-server --server engine --config-file /etc/mistral/mistral.confstart-ovsdb-server 127.0.0.1/usr/share/elasticsearch/bin/elasticsearchsleep infinity/usr/share/elasticsearch/bin/elasticsearchbarbican-workersleep infinitynova-conductorbarbican-worker/opt/kafka/bin/kafka-server-start.sh /etc/kafka/kafka.server.propertiesnova-compute/usr/sbin/libvirtd --listen/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2/usr/sbin/apache2no ...


but it's too messy to read.
How do I put each record (content of each file) on a separate line?



run_comand_content1
run_comand_content2
run_comand_content3


or



run_comand_content1

run_comand_content2

run_comand_content3




This question already has an answer here:



  • Force newlines with cat wildcard printing

    6 answers



  • How can I wrap text at a certain column size?

    6 answers







bash cat wrap






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 22 at 9:09









ctrl-alt-delor

11.3k42058




11.3k42058










asked Jan 22 at 2:12









bohan Chenbohan Chen

12




12




marked as duplicate by Sparhawk, G-Man, Mr Shunz, Christopher, roaima Jan 22 at 16:48


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by Sparhawk, G-Man, Mr Shunz, Christopher, roaima Jan 22 at 16:48


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









  • 1





    Can do wrap? is not a very clear description of how the output should look .... a simple wrap is also "messy"

    – jsotola
    Jan 22 at 2:22












  • sorry, I add the description.

    – bohan Chen
    Jan 22 at 3:29












  • 1





    Can do wrap? is not a very clear description of how the output should look .... a simple wrap is also "messy"

    – jsotola
    Jan 22 at 2:22












  • sorry, I add the description.

    – bohan Chen
    Jan 22 at 3:29







1




1





Can do wrap? is not a very clear description of how the output should look .... a simple wrap is also "messy"

– jsotola
Jan 22 at 2:22






Can do wrap? is not a very clear description of how the output should look .... a simple wrap is also "messy"

– jsotola
Jan 22 at 2:22














sorry, I add the description.

– bohan Chen
Jan 22 at 3:29





sorry, I add the description.

– bohan Chen
Jan 22 at 3:29










2 Answers
2






active

oldest

votes


















3














You could put it in a loop:




for i in /proc/[0-9]*
do
printf "$it"
cat $i/root/run_command
printf "n"
done





share|improve this answer






























    0














    You can use awk:



    awk 'FNR==1printf ""1' */root/run_command


    or separate by --- or new line:



    awk 'FNR==1print "---"1' */root/run_command
    awk 'FNR==1printf "n"1' */root/run_command



    See here for more answers, e.g. using sed:



    sed -e '$s/$/n/' -s */root/run_command





    share|improve this answer































      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      3














      You could put it in a loop:




      for i in /proc/[0-9]*
      do
      printf "$it"
      cat $i/root/run_command
      printf "n"
      done





      share|improve this answer



























        3














        You could put it in a loop:




        for i in /proc/[0-9]*
        do
        printf "$it"
        cat $i/root/run_command
        printf "n"
        done





        share|improve this answer

























          3












          3








          3







          You could put it in a loop:




          for i in /proc/[0-9]*
          do
          printf "$it"
          cat $i/root/run_command
          printf "n"
          done





          share|improve this answer













          You could put it in a loop:




          for i in /proc/[0-9]*
          do
          printf "$it"
          cat $i/root/run_command
          printf "n"
          done






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 22 at 4:03









          kevlinuxkevlinux

          30413




          30413























              0














              You can use awk:



              awk 'FNR==1printf ""1' */root/run_command


              or separate by --- or new line:



              awk 'FNR==1print "---"1' */root/run_command
              awk 'FNR==1printf "n"1' */root/run_command



              See here for more answers, e.g. using sed:



              sed -e '$s/$/n/' -s */root/run_command





              share|improve this answer





























                0














                You can use awk:



                awk 'FNR==1printf ""1' */root/run_command


                or separate by --- or new line:



                awk 'FNR==1print "---"1' */root/run_command
                awk 'FNR==1printf "n"1' */root/run_command



                See here for more answers, e.g. using sed:



                sed -e '$s/$/n/' -s */root/run_command





                share|improve this answer



























                  0












                  0








                  0







                  You can use awk:



                  awk 'FNR==1printf ""1' */root/run_command


                  or separate by --- or new line:



                  awk 'FNR==1print "---"1' */root/run_command
                  awk 'FNR==1printf "n"1' */root/run_command



                  See here for more answers, e.g. using sed:



                  sed -e '$s/$/n/' -s */root/run_command





                  share|improve this answer















                  You can use awk:



                  awk 'FNR==1printf ""1' */root/run_command


                  or separate by --- or new line:



                  awk 'FNR==1print "---"1' */root/run_command
                  awk 'FNR==1printf "n"1' */root/run_command



                  See here for more answers, e.g. using sed:



                  sed -e '$s/$/n/' -s */root/run_command






                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Jan 22 at 9:41

























                  answered Jan 22 at 9:33









                  RoVoRoVo

                  3,141216




                  3,141216












                      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?