[SLUG] Conversion question

From: Chuck Hast (wchast@gmail.com)
Date: Wed Jan 17 2007 - 13:06:02 EST


I am dealing with that old buggaboo, the end of line conventions which for
unix type systems is the 0x0A or LF. For dos/win it is 0x0D or the CR.

If I was just converting the file for dos/win use I would just run it through
unix2dos and let it dump it into a new file with the proper format. But in
this case I have a small script that reads a file out to the screen, so what
I need to do is the conversion and have the result dumped to the screen,
here is a sample of one, it reads the file from one of the files in proc.

#!/bin/bash
#
while : ; do
 cat /proc/net/rose_neigh
  sleep 1
  clear
  done

This is the output:
addr callsign dev count use mode restart t0 tf digipeaters
00043 KC5QCN-9 sp0 10 0 DTE no 0 0
00042 KD4YAL-9 ax0 1 1 DTE yes 0 0
00041 W4MIN-9 ax0 1 0 DTE no 0 0
00040 N3PPC-9 ax0 2 0 DCE yes 0 0
00039 N4PLZ-9 ax0 8 1 DCE yes 0 0
00038 F5KBW-9 ax0 9 1 DTE yes 0 0
00037 F6BVP-11 ax0 12 0 DTE yes 0 0
00036 VK2TV-2 ax0 1 1 DCE yes 0 0
00032 K4GBB-9 ax0 12 1 DTE yes 0 0
00001 RSLOOP-0 ??? 5 0 DCE yes 0 0

This is the output if viewed on a win machine:

addr callsign dev count use mode restart t0 tf digipeaters
00043 KC5QCN-9 sp0 10 0 DTE no 0 0

     00042 KD4YAL-9 ax0 1 1 DTE yes 0 0
               00041 W4MIN-9 ax0 1 0 DTE no 0 0

                00040 N3PPC-9 ax0 2 0 DCE yes 0 0
                           00039 N4PLZ-9 ax0 8 1 DCE yes 0 0
So I need to add unix2dos or a sed statement that will intercept the file and
do the conversion and then output it to the screen.

I am way down at the bottom when it comes to scripts as you can see. I
bet there is a better way to even do that script, but little by little.

-- 
Chuck Hast  -- KP4DJT --
To paraphrase my flight instructor;
"the only dumb question is the one you DID NOT ask resulting in my going
out and having to identify your bits and pieces in the midst of torn
and twisted metal."
-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS).  Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 20:37:02 EDT