Question: How to remove END OF LINE using AWK or SED 
Author Message
 Question: How to remove END OF LINE using AWK or SED

Hi all,

my question: How can I remove End-of-line characters in a stream on
my MS-DOS-PS using AWK or SED as a filter?
Example: My file contains three lines:
line1
line2
line3
This file should be shortened to one single line with a command
like this:
TYPE filename | AWK .......... or SED ..........
After using AWK or SED as a filter (!), the output should look like
this:
line1 line2 line3
or maybe even
line1line2line3
Can anyone tell me how this can be handled using AWK or SED?
Or maybe another filter for this purpose exists on MS-DOS-platforms?
Many thanks for your answers (via PM) in advance.



Mon, 08 Feb 1999 03:00:00 GMT  
 Question: How to remove END OF LINE using AWK or SED

: Hi all,

: my question: How can I remove End-of-line characters in a stream on
: my MS-DOS-PS using AWK or SED as a filter?
: Example: My file contains three lines:
: line1
: line2
: line3
: This file should be shortened to one single line with a command
: like this:
: TYPE filename | AWK .......... or SED ..........
: After using AWK or SED as a filter (!), the output should look like
: this:
: line1 line2 line3
: or maybe even
: line1line2line3
: Can anyone tell me how this can be handled using AWK or SED?
: Or maybe another filter for this purpose exists on MS-DOS-platforms?

awk '{ printf "%s", $0 }'
will work, but if you have access to tr,
tr -d "\012\015"

: Many thanks for your answers (via PM) in advance.
                                ^^^^^^
sorry, we're a usenet group, not a consulting firm.

andru



Mon, 08 Feb 1999 03:00:00 GMT  
 Question: How to remove END OF LINE using AWK or SED


Quote:

>Hi all,

>my question: How can I remove End-of-line characters in a stream on
>my MS-DOS-PS using AWK or SED as a filter?

awk '{printf "%s",$0}'
--

"Outside of a dog, a book is man's best friend.  Inside a dog, it's too
dark to read." -- Marx (or was it Twain?)


Mon, 08 Feb 1999 03:00:00 GMT  
 Question: How to remove END OF LINE using AWK or SED


muenchen.de writes

Quote:
>Hi all,

>my question: How can I remove End-of-line characters in a stream on
>my MS-DOS-PS using AWK or SED as a filter?
>Example: My file contains three lines:
>line1
>line2
>line3
>This file should be shortened to one single line with a command

>Can anyone tell me how this can be handled using AWK or SED?
>Or maybe another filter for this purpose exists on MS-DOS-platforms?
>Many thanks for your answers (via PM) in advance.


awk '{ printf($0) } END { printf("\n") }'

I couldn't say for DOS but if you have tr you could run

tr -d "\n"
--
Adam Lovick



Tue, 09 Feb 1999 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. join a range of lines using awk/sed

2. using awk to remove header and footer lines

3. problem with line-ends in sed

4. Sed/AWK - replace positions in multiple lines.

5. Removing End of Line and carrige return

6. Extracting hyphenated words using sed/awk

7. Using awk And/Or sed To Edit Fourth Field Of File

8. how to insert a comma using either sed or awk

9. extracting top 100 data using awk or sed/perl

10. Q: Directory highlighting using sed/awk?

11. deleting records in a file using AWK, SED, or kshell

12. deleting records using AWK, SED, etc.

 

 
Powered by phpBB® Forum Software