[HPADM] SUMMARY +additional info to vi question

From: Hustert Klaus-CKH035 (Klaus.Hustert@motorola.com)
Date: Fri Apr 25 2003 - 05:46:01 EDT


Thanks to Bill that he add a very good additional solution

He also hint me that I have to be aware of which numbers I mean, e.g. 12 is the line feed and 14 is the form feed (in octal!!!), in dec is 12 the form feed and 14 shift out ;-).

Bill wrote:
Use tr, it's much faster and simpler:

     tr -c "\014" "\040" < some_data_file > new_data_file

  014 is the CTRL-L or formfeed character (see man ascii)
  I used \040 to change the formfeed to a space. Just replace
  040 with whatever character you want from the ASCII chart.
  ALWAYS use a leading zero to specify an octal string as shown
  in the man page for ascii.

Thanks again to all.

-- Klaus

Hi again,
Thanks a lot who has responed:

For the actual script I will use the ^v^L (ctrl v and ctrl L) solution. In future I will using sed or ed to get more speed.

Here the suggestions: ################################################################################################
Note that ^M is your guide, ^ (that is ^ and a space) is an ascii-readable view to value 0. ^A is for 1, ^B is for 2, ^L is for 12 and so on.

If you know the <ctrl>v followed by a non-readable ascii code, you most likely once accidently hit <ctrl>vv and view at the prompt, it shows ^V !!

THere you have it, to get ^L, just type <ctrl>v<ctrl>l. (and so you can also get ^M with <ctrl>v<ctrl>m)....
The origin is the other way round: ^V is shorthand for <ctrl>v.

Thanks to Corné, Harm and Cooper (excuse me when I am using the last name, I dunno it better ;-))

################################################################################################
If you've got Perl installed, you can do this from the command line:

$ perl -pi -e 's/\014//g' myfile
Thanks to Christopher ################################################################################################

sed -e 's/Ctrl-V Cr//g' -e 's/Ctrl-V Ctrl-L//g' File > file.out Thanks to Jack, Brett, Stuart

Original question:
Hi folks,
I have a data stream and have to replace the form feed (^L; ASCII 12) with another symbol. My script looks like:

vi xxx <<EOF1
:%s/^M//g # I know I have to press ctrl+v in insert mode
            # and than the carrage return key to get the ^M
:%s/^L//g # ,but how can I get the ^L ???
:wq!
EOF1

Thanks in advance for advice.

Klaus

--
             ---> Please post QUESTIONS and SUMMARIES only!! <---
        To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl
       Name: hpux-admin@dutchworks.nl     Owner: owner-hpux-admin@dutchworks.nl
 
 Archives:  ftp.dutchworks.nl:/pub/digests/hpux-admin       (FTP, browse only)
            http://www.dutchworks.nl/htbin/hpsysadmin   (Web, browse & search)
--
             ---> Please post QUESTIONS and SUMMARIES only!! <---
        To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl
       Name: hpux-admin@dutchworks.nl     Owner: owner-hpux-admin@dutchworks.nl
 
 Archives:  ftp.dutchworks.nl:/pub/digests/hpux-admin       (FTP, browse only)
            http://www.dutchworks.nl/htbin/hpsysadmin   (Web, browse & search)


This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 11:02:29 EDT