开发者

How to handle non-printable ASCII character parameters?

I'm working on a project where we are dealing with importing/exporting data from database tables using ksh scripts and Perl scripts. We have an existing process to export data from a table to a file and it is then imported into another system.

Here's the catch - the export process dumps out pipe delimited files while the system that is doing the import expects files delimited by the ASCII group separator character which is decimal 29, hexidecimal 1d, or octal 35. It shows up in vi as ^] Right now, I'm converting the delimiter via a Perl script. What I'd like to do is tell our export process to just use the delimiter we are expecting. Something like:

export_table.ksh -d '\035'

The problem is I can't figure out how to pass this character to the export script.

I've tried all kinds of combinations of single quotes, double quotes, backslashes, and the octal and hex version of this c开发者_StackOverflow社区haracter.

I'm on Solaris 10 using ksh and/or Perl.


have you tried:

$'\x29'

actually try this for ]:

echo $'\x5d'

and for ^

echo $'\x5e'

so you just need to do:

export_table.ksh -d $'\x5e\x5d'


In bash(1), one can prefix a character with ^v to enter that character verbatim. Perhaps ksh(1) does the same?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜