Skip to content

Instantly share code, notes, and snippets.

@mo6020
Last active February 9, 2016 11:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mo6020/fd439c86ec79660ac3e0 to your computer and use it in GitHub Desktop.
Save mo6020/fd439c86ec79660ac3e0 to your computer and use it in GitHub Desktop.
Convert Netapp body.7z to old style ASUP for ConfigAdvisor offline - Credit to @JK-47 for this, not my work..
# Make all text type file names upper case
perl -e 'for(@ARGV){rename$_,uc}' *.txt
perl -e 'for(@ARGV){rename$_,uc}' *.xml
# Replace underscores with DASHES
perl -e 'do { (my $f = $_) =~ tr/_/-/; rename $_, $f } for glob "@ARGV"' *.XML
perl -e 'do { (my $f = $_) =~ tr/_/-/; rename $_, $f } for glob "@ARGV"' *.TXT
# Save @JK-47's asupsections.txt to the directory. (This is just
# headers and helps me call to the other files)
wget http://www.jk-47.com/wp-content/uploads/2015/06/asupsections.txt
# Merge the files into legacy format.
ASUPFILE="`grep X-Netapp-asup-hostname X-HEADER-DATA.TXT | awk '{print $2}'`_asup.txt"
echo $ASUPFILE
for i in `awk -F"===== " '{print $2}' asupsections.txt | awk -F" =====" '{print $1}'`; do echo "===== "$i" =====" >> $ASUPFILE ; cat $i.TXT >> $ASUPFILE; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment