JP Vossen on 20 May 2013 22:04:06 -0700

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PLUG] 2013-05-21 PLUG W follow-up

Thanks to Walt for an interesting look at NumPy and SciPy.

We also talked about formatting output from bash scripts. I suggested plain old 'echo' or 'printf' commands. Note that 'printf' is POSIX but 'echo' is not, and 'echo' *does* behave differently by default on various different systems. E.g. on some systems "\n" is expanded to a newline while on others (like Linux) you need to use 'echo -e' (but see "xpg_echo" as well [1]). Or you can output tab delimited or CSV output and import into a spreadsheet. Someone also mentioned the 'fmt' command, which can be useful. The 'fmt' and possibly 'column', 'colrm', 'awk' and 'cut' commands may also be of interest. When I know I'm going right into a spreadsheet though, I just do tab delimited output like 'echo -e "Foo\tBar\tbaz"'. It's really easy...

At dinner, among other things, we talked about logging using 'screen'. The simplest use is just 'screen -L' which will create 'screenlog.*' in your home dir. You can pass a "logfile" or "log (on|off)" commands manually, in an rc file or via 'screen -X' while inside screen. I talked about that in the _bash Cookbook_ recipe 17.6 "Logging and Entire Session or Batch Job."


[1] For bash docs in general and "xpg_echo" per above in particular, start at then look for "The bash Reference Guide" for your bash version, e.g.,

JP Vossen, CISSP            |:::======|
My Account, My Opinions     |=========|
"Microsoft Tax" = the additional hardware & yearly fees for the add-on
software required to protect Windows from its own poorly designed and
implemented self, while the overhead incidentally flattens Moore's Law.
Philadelphia Linux Users Group         --
Announcements -
General Discussion  --