bash - send '%' in cut command (linux) -


i wring script using vbscript. script needs run in cmd , connect system linux os. need use cut command take specific number. when trying send % via script sends .

any ides?

this code:

oshell.sendkeys "cat /tmp/dftemp1.txt | cut -d'%' -f1 > /tmp/dftemp2.txt" 

when use code in securecrt it's working. when copy line , paste manually in cmd line it's working too. it's not working when trying run automatclly.

when in doubt, read documentation.

the sendkeys method uses characters modifiers of characters (instead of using face-values). set of special characters consists of parentheses, brackets, braces, , the:

    plus sign +,
    caret ^,
    percent sign %,
    and tilde ~

send these characters enclosing them within braces "{}". example, send plus sign, send string argument "{+}".

change this:

oshell.sendkeys "cat /tmp/dftemp1.txt | cut -d'%' -f1 > /tmp/dftemp2.txt" 

into this:

oshell.sendkeys "cat /tmp/dftemp1.txt | cut -d'{%}' -f1 > /tmp/dftemp2.txt" 

or, use plink (from putty suite), don't need fiddle around sendkeys in first place.

plink user@host "cat /tmp/dftemp1.txt | cut -d'%' -f1 > /tmp/dftemp2.txt" 

Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

python - pip wont install .WHL files -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -