Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

removing new lines i a text file

Status
Not open for further replies.

Larshg

Programmer
Mar 1, 2001
187
DK
Hi

How do I remove all new lines i a text file and replace them with a space

/Larshg
 

in vi

:1,$j
or
:%j


in other tools, you need arrays,
see (and try) man pages 'tr'

:) guggach
 
man tr

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
'c' still remains your best friend.

compile it, call: fname < inputname

#include <stdio.h>
int main()
{
register int aa;
while((aa = getchar()) != EOF)
putchar((aa == '\n') ? ' ' : aa);
putchar('\n'); /* append a newline at end */
exit(0);
}

:) guggach
 
naaah, I'd say buy a couple of Cray's and ask NASA for their Mission Critical software.

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top