Conversion question about ksh


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Conversion question about ksh
# 1  
Old 04-13-2007
Conversion question about ksh

Hi all,

New to ksh and had a few questions to see if this is doable in ksh or if I am going to have to call out to a tcl procedure. I have an Ascii file I want to convert to hex then search and remove all hex chars '0A' and then convert back to Ascii. Here is an example of an Ascii file I am dealing with:

FHS|^~\&|SIS|MSAE|BAR|MSAE|200704101402
BHS|^~\&|SIS||||200704101402
MSH|^~\&|SIS|SAE|||20070302114940||DFT^P03|1092|D|2.2
EVN|P03|200703021149
PID|1||MC00319092|||||||||||||||003190921008
FT1|1|||20051227||CH|76010200|||1
MSH|^~\&|SIS|SAE|||20070302114940||DFT^P03|1092|D|2.2
EVN|P03|200703021149
PID|1||MC00319092|||||||||||||||003190921008
FT1|1|||20051227||CH|76010200|||1

Thanks for any input
# 2  
Old 04-13-2007
It is not that easy between ascii and hex in ksh. But your task is just:
Code:
/usr/bin/ksh
tr -d "
" < oldfile > newfile
exit 0

That is just a newline character in the double quotes.
# 3  
Old 04-13-2007
Thankyou Perderabo for all your input! That should solve my dilemma.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Typeset conversion problem from ksh to bash

Hi, typeset -l sgf # all lowercase letters typeset -u SGF # all uppercase letters sgf=$1 SGF=$sgf these lines used in my scripts . It ran fine in ksh but when we convert this to bash it erroring out. I like to know what the use of typeset ?? Thanks & Regards kanagaraj (3 Replies)
Discussion started by: kanagaraj
3 Replies

2. Shell Programming and Scripting

Timestamp to date conversion in ksh

Hi, I have a file containing timestamp( Example given below). How can i get date(mmd-dd-yyyy) from it? ($> cat file1.txt 2008-11-24 05:17:00.7043) Thanks, Sri (2 Replies)
Discussion started by: srilaxmi
2 Replies

3. Shell Programming and Scripting

Perl in KSH - julian conversion

Hello Everyone, I have this code misbehaving in one of my scripts, I have a var containing the sequential number of the day for the year and I am suppose to get the regular date for that day and its weekday. If I set the day to 273 I get back 2008/09/31 which is not a proper date. can you help... (7 Replies)
Discussion started by: gio001
7 Replies

4. Shell Programming and Scripting

Does KSH support data type conversion?

Hello,everyone here. I'm coding with KSH to achieve exploring the disk space and judging whether it closes to overflow.But It seems that no one way to convert a string variable to integer. df | read A B C D E F G H I J K L print ${L} Can I convert L to integer type? Thanks for... (2 Replies)
Discussion started by: joshuaduan
2 Replies

5. UNIX for Dummies Questions & Answers

ksh question

How can I know if my system has ksh feature? #!/usr/bin/ksh Which command we allow me to see? Please advise! (1 Reply)
Discussion started by: bobo
1 Replies

6. Shell Programming and Scripting

A Question On Recursion In Ksh

Hi Folks, I would just like to know how recursion works in ksh or inside a shell in general. I created the following script, but it works(runs recursively) only for 64 times: ---------------- #! /usr/bin/ksh displaymessage() { echo "displaying count: $cnt " echo "wait for 1 second..."... (1 Reply)
Discussion started by: marlonus999
1 Replies

7. Shell Programming and Scripting

csh -> ksh conversion question

Having been a long-time csh person I now need to convert a lot of stuff to run under ksh. Can anyone tell me how to do a ksh equivalent of the csh history substitution !* that can be used in an alias, ie how would I do: alias cd "cd \!*; pwd" alias find "find . -name... (2 Replies)
Discussion started by: jonnywilkins
2 Replies

8. Shell Programming and Scripting

KSH scripting question

Good day, I am trying to write a script that completes an ssh challenge to a specific server and writes output to a log. We have shared ssh keys for the script user. My challenge is a simple hostname check; ssh $host hostname My problem arrises when there is an actual challenge, be it... (3 Replies)
Discussion started by: M-Pacificorp
3 Replies

9. Shell Programming and Scripting

Perl conversion & perldoc question

Working my way through a perl book and can't find this; You can convert from binary to ordinal numbers using 0b in front of the binary value but how do you go the other way, from ordinal to binary? Is there a function for this? On Perldoc, is there a document that gives all of the available... (2 Replies)
Discussion started by: thumper
2 Replies

10. Shell Programming and Scripting

How to ask a question to a user in ksh

Hello, I am writing a script in ksh(for HP Unix)where a user must answer to a question . So I want to know kow to test if the user do not answer , so if he enter "REturn". I don't know how to test "space characters" or "empty characters Thanks for your help (2 Replies)
Discussion started by: steiner
2 Replies
Login or Register to Ask a Question