Forum Discussion
nkingcade_12003
Nimbostratus
Sep 05, 2013Export to Excel or .CSV
I would like to export CLI information, mostly performance information, to MSExcel or to a CSV file. I tried redirection from the command line. Is this redirection possible?
uni
Altocumulus
Sep 06, 2013Jason's method above is great if it is long term. For a quick-and-dirty solution, this perl will convert your output for you. Put it in a file, such as field-to-csv, and run it like this:
tmsh show ltm virtual field-fmt raw | field-to-csv
!/usr/bin/perl
while ($line = <>) {
chomp($line);
if ($line =~ /{/) { $out = ""}
elsif ($line =~ /}/) { print "$out\n" }
else {
$out .= "," if (length($out) != 0);
($field,$value) = split(" ",$line,2);
if ($value =~ /,/)
{ $out .= "\"$value\"" }
else
{ $out .= $value }
}
}
uni
Altocumulus
Sep 06, 2013finally got the formatting right
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects