It is currently Fri, 15 Oct 2021 20:06:02 GMT



 
Author Message
 Need To Insert Carriage Return
I need to insert a carriage return (hex 0d) before the newline (hex 0a)
of every record in a file of 80 col records.

I have looked at sed and awk but so far no luck, maybe someone out there
has the answer. Thanks....
--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
LARRY BACA,                                                       marst2!lbaca
DAASO-VWA AIS, DEFENSE AUTOMATIC ADDRESSING OFFICE, WESTERN DIVISION
DDTC TRACY, TRACY CA. 95376-5057  AUTOVON 462-9391  COMERCIAL 832-9391



 Tue, 01 Mar 1994 02:17:31 GMT   
 Need To Insert Carriage Return
From the keyboard of fmd3201@marst2 (Larry Baca):
:I need to insert a carriage return (hex 0d) before the newline (hex 0a)
:of every record in a file of 80 col records.
:
:I have looked at sed and awk but so far no luck, maybe someone out there
:has the answer. Thanks....

sed -e 's/$/^M/'

should suffice, but your shell may not let you pass in the ^M directly,
you you'd have to put it in a file.

perl -pe 's/$/\r/'

would also work, and wouldn't have that trouble.

--tom



 Tue, 01 Mar 1994 21:21:41 GMT   
 Need To Insert Carriage Return

Does your system have a filter called unix2dos ? I'm not sure whether it is
an add-on or comes standard. The last two systems I have used (SunOS and
Microport) have had it. (But the SunOS had a PC networked, and the Microport
also has Merge installed).

--------------------------------------           ******************************
Orville R. Weyrich, Jr., Ph.D.                   Certified Systems Professional
Internet: orville%weyr...@uunet.uu.net             Weyrich Computer Consulting
Voice:    (602) 391-0821                         POB 5782, Scottsdale, AZ 85261
Fax:      (602) 391-0023                              (Yes! I'm available)
--------------------------------------           ******************************



 Fri, 04 Mar 1994 04:03:43 GMT   
 Need To Insert Carriage Return

Well, no...

  echo 'sed -e '\''s/$/M/'\' | tr M '\015' | sh

---Dan



 Fri, 04 Mar 1994 12:45:03 GMT   
 Need To Insert Carriage Return

To embed control characters and/or tabs (for some reason tcsh thinks tabs
are 'special') in a UNIX command line I precede
the character in question with a Control-v (i.e. ^v^M in the above).
I found this out sort of by accident, its very useful.  I use it in tcsh
but it also works for ksh and prob. sh and csh too.



 Tue, 08 Mar 1994 05:17:47 GMT   
 Need To Insert Carriage Return
In article <7...@coal5.UUCP>, yea...@motcid.UUCP (Tony J Yeates) writes:
|>
|> To embed control characters and/or tabs (for some reason tcsh thinks tabs
|> are 'special')

<TAB> in tcsh is the file expansion character.

|> in a UNIX command line I precede
|> the character in question with a Control-v (i.e. ^v^M in the above).
|> I found this out sort of by accident, its very useful.  I use it in tcsh
|> but it also works for ksh and prob. sh and csh too.

CTRL-V is the "statndard" escape character used in vi, tcsh, etc...
I believe emacs also?
--
Frank Mostek                    uunet!motcid!maize!mostek
(708)632-6965                   mos...@maize.rtsg.mot.com



 Tue, 08 Mar 1994 06:35:28 GMT   
 Need To Insert Carriage Return
In article <1991Sep19.223528.29...@rtsg.mot.com>, mos...@clear13.Berkeley.EDU (Frank B. Mostek) writes:
|> CTRL-V is the "statndard" escape character used in vi, tcsh, etc...
|> I believe emacs also?

Assuming that you mean GNU emacs (I don't know about others such as CCA
emacs), no, ^V does not quote in emacs, it pages the file forward one screen.
^Q is the quoting character in emacs.

--
Jonathan Kamens                               USnail:
MIT IS/Athena                                   11 Ashford Terrace
j...@Athena.MIT.EDU                         Allston, MA  02134
Office: 617-253-8085                          Home: 617-782-0710



 Wed, 09 Mar 1994 04:24:26 GMT   
 
   [ 7 post ] 

Similar Threads

1. How to insert Carriage Return in a file ?

2. ftp via Apache proxy inserting Carriage Return

3. Need to Strip carriage returns from text file

4. Need to add a \n carriage return after every occurance of a char

5. Need help reading single character without carriage return.

6. SED - I need to insert hard returns into a file

7. echo with CARRIAGE RETURN

8. cups and carriage returns

9. Using grep to find PC carriage returns

10. Another simple queries - no carriage return when printing - funny format


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software