1.

Solve : copy literal string to a Linux file?

Answer» USING Linux I have a script which EXECUTES various programs e.g. netstat, ps -ef|grep ....   and directs the output to a common file. I've noticed that
the output is strung together  i.e.  no separator between e.g. netstat and then another netstat. I'd like to insert a separator literal between them
to make the viewing of the output file easier.. rather than try to determine where the output of one netstat ends and the next begins..

Anyone have an idea  I've tried cp 'string' >> output file   but that failed with a syntax error....try
Code: [Select]echo 'string' >> output file
I've tried -      cat 'string' >> /output file.                   It results in a syntax error  - no such file 'string'.. Quote from: BRIANH on February 01, 2011, 01:04:29 PM
I've tried -      cat 'string' >> /output file.                   It results in a syntax error  - no such file 'string'..
OK, any luck using echo as I suggested? Quote from: BRIANH on February 01, 2011, 01:04:29 PM
I've tried -      cat 'string' >> /output file.                   It results in a syntax error  - no such file 'string'..
cat does not work on strings. It works on files. Use echo or printf.
But I SUSPECT you are reading your output CREATED in *NIX on a windows program such as notepad?


Discussion

No Comment Found