4 Replies Latest reply on Apr 20, 2018 11:27 AM by wluther

    Script to remove characters out of host name

    treiling

      I have about 100 ASAs we need to change the host name on. When they were first created someone added ASA[City] as the host name. I tried to make a script to delete the first 3 characters (the ASA part) but it keeps giving me strange results.

      Here is what I tried:

      conf t

      ${SysName}${CTRL+A}${RIGHTARROW}${RIGHTARROW}${RIGHTARROW}${BACKSPACE}${BACKSPACE}${BACKSPACE}hostname ${CRLF}

       

      I basically tried to simulate typing the host name, going to the beginning of the command line(CTRL+A), arrowing over and back spacing the first 3 letters, then adding "hostname " since the cursor should be at the beginning of the line again.

      When I try and run this, it basically doesn't understand most of my variables even though they are in the manual. (backspace wasn't, but I had to try)

      here is the output:

      4/19/2018 2:23:35 PM on ASANewYork (X.X.X.X) by Admin

       

      conf t

      ASANewYork${CTRL+A}${RIGHTARROW}${RIGHTARROW}${RIGHTARROW}${BACKSPACE}${BACKSPACE}${BACKSPACE}hostname

       

      Is there an easy way to accomplish what I'm trying to do?

      Thanks,

      Travis