home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / os / msdos / misc / 6194 < prev    next >
Encoding:
Internet Message Format  |  1992-11-17  |  3.9 KB

  1. Path: sparky!uunet!charon.amdahl.com!pacbell.com!ames!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!destroyer!ncar!noao!amethyst!organpipe.uug.arizona.edu!news
  2. From: sfm@manduca.neurobio.arizona.edu (Stephen Matheson)
  3. Newsgroups: comp.os.msdos.misc
  4. Subject: Re: Echo command in batch files
  5. Message-ID: <1992Nov17.235800.12898@organpipe.uug.arizona.edu>
  6. Date: 17 Nov 92 23:58:00 GMT
  7. References: <tim.12.722026318@tim.src.utah.edu>
  8. Sender: news@organpipe.uug.arizona.edu
  9. Organization: University of Arizona UNIX Users Group
  10. Lines: 114
  11.  
  12. From article <tim.12.722026318@tim.src.utah.edu>,
  13. by tim@tim.src.utah.edu (Tim Ma):
  14.  
  15. > To "suppress" the CR/LF in the DOS echo command, try:
  16. > echo hello>temp world >> temp
  17. > Output should be:
  18. > hello world
  19. > Seems to work with MSDOS 5.0.
  20. > Tim Ma
  21.  
  22. Another idea, similar to one proposed below in your summary, but
  23. simpler, I think:
  24.  
  25. Send the output strings to your batch file via replaceable parameters
  26. (e.g., replaceable parameters %1 and %2 set to become your strings,
  27. then invoke batch program by BATCH %1 %2).
  28.  
  29. Within the batch program, include ECHO %1 %2.
  30.  
  31. For example,
  32.  
  33.     SET %1=Hello
  34.     SET %2=world
  35.  
  36. would appear somewhere after obtaining the strings.  Say the batch
  37. file is HELOWRLD.BAT.  Start it by typing or calling HELOWRLD %1 %2.
  38. Then, in HELOWRLD, the line
  39.  
  40.     ECHO %1 %2
  41.  
  42. yields "Hello world"; similarly, ECHO %1, %2 yields "Hello, world",
  43. etc.
  44.  
  45. I am using two environment variables here, but no concatenation or
  46. temporary files.  Perhaps you will find this less "clumsy".
  47.  
  48.  
  49. > Original Message below:
  50. > -----------------------------------------------------------------------------
  51. > In article <1992Nov16.204439.17539@oracle.us.oracle.com>
  52. >skanga@us.oracle.com (Shiraz Kanga) writes:
  53. >>From: skanga@us.oracle.com (Shiraz Kanga)
  54. >>Subject: Re: Echo command in batch files
  55. >>Date: Mon, 16 Nov 1992 20:44:39 GMT
  56. >>
  57. >>In article <1992Nov14.190918.9554@oracle.us.oracle.com>
  58. >>skanga@us.oracle.com (Shiraz Kanga) writes:
  59. >>>Hi folks
  60. >>>
  61. >>>Does anyone know how to prevent echo from issuing a CR/LF at the
  62. >>>end of a line.
  63. >>>
  64. >>>Eg : If I create the following file called test.bat
  65. >>>
  66. >>>echo hello > temp
  67. >>>echo world >> temp
  68. >>>
  69. >>>The result in temp is:
  70. >>>hello 
  71. >>>world
  72. >>>
  73. >>>I need the result to be:
  74. >>>hello world
  75. >>>
  76. >>>And yes I know echo hello world will work but what I'm trying to do is
  77. >>>concatenate two strings which are output by two different programs and
  78. >>>get both onto one line.
  79. >>>
  80. >>>Please respond by mail and I'll summarize to the net if there's interest.
  81. >>>
  82. >>>thanks
  83. >>>
  84. >>>shiraz
  85. >>>skanga@oracle.com
  86. >>>-- 
  87. >>>Shiraz Kanga (skanga@oracle.com) Tel: (415)506-5412 Fax: (415)506-7822
  88. >>>Analyst -- Desktop Tools Group -- Worldwide Technical Support -- 3OP11
  89. >>>Oracle Corporation 500 Oracle Pkwy, MS 659311, Redwood Shores CA 94065
  90. >>>"I work for Oracle - I speak and type (over here at least) for myself"
  91. >>
  92. >>Well folks, as promised heres my summary (since there was little interest)
  93. >>
  94. >>Some people suggested using external echo commands (xecho, etc) which are
  95. >>available for anonymous ftp from various sites. This is not useful for me
  96. >>since I am not using echo only.
  97. >>
  98. >>Another person suggested trying an embedded backspace which might erase the
  99. >>CR/LF characters in the file. I did try this before posting and could not get
  100. >>it to work.
  101. >>
  102. >>The most useful suggestion was to concatenate the strings in the
  103. >>dos environment
  104. >>and then output the variable to a text file. I will try this
  105. >>(albeit clumsy) method as soon as I have the time.
  106. >>
  107. >>Thanks for the replies
  108. >>
  109. >>Shiraz
  110. >>-- 
  111. >>Shiraz Kanga (skanga@oracle.com) Tel: (415)506-5412 Fax: (415)506-7822
  112. >>Analyst -- Desktop Tools Group -- Worldwide Technical Support -- 3OP11
  113. >>Oracle Corporation 500 Oracle Pkwy, MS 659311, Redwood Shores CA 94065
  114. >>"I work for Oracle - I speak and type (over here at least) for myself"
  115.  
  116. --
  117.  
  118. Steve Matheson   Program in Neuroscience   University of Arizona
  119. sfm@neurobio.arizona.edu
  120.