Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I run the following line on linux/solaris machine ( all output will write in to /tmp/Log from application.bin )

 ./application.bin 1>>/tmp/Log

We can see the content of the /tmp/Log file

 more /tmp/Log

/etc/opt/OA/share/conf/OpC/mgmt_sv/ui/registration/C/opc_op /etc/opt/OA/share/conf/analysis/system_odbc.iniaaaa
/etc/opt/OA/share/conf/ovspmd.authaaaa
/etc/opt/OA/share/conf/ovwdb.authaaaa
/etc/opt/OA/share/conf/ovw.authaaaa 

My question:

what I need to change or add in the syntax:

   "1>>/tmp/Log" ? 

in order to add space between each line as the following example

       /etc/opt/OA/share/conf/OpC/mgmt_sv/ui/registration/C/opc_op
  .
       /etc/opt/OA/share/conf/analysis/system_odbc.iniaaaa
  .
       /etc/opt/OA/share/conf/ovspmd.authaaaa
  .
       /etc/opt/OA/share/conf/ovwdb.authaaaa
  .
       /etc/opt/OA/share/conf/ovw.authaaaa 

Remark – the option to add space between each line after /tmp/Log was created isn’t relevant

share|improve this question

1 Answer 1

up vote 3 down vote accepted
./application.bin | sed '$!G' >> /tmp/Log
share|improve this answer
    
$ meaning "only on the last line"; ! negate the line selector, i.e. on every line except the last one; G append a new-line to pattern (the line) and the "hold space" (empty by default) - equivalent of s/$/\n/ –  peterph Dec 7 '12 at 0:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.