Welcome to iraf.net Thursday, May 09 2024 @ 02:23 PM GMT
Gaba_p |
04/07/2009 06:32PM (Read 1509 times)
|
|
|
Status: offline
Registered: 10/10/2008
Posts: 104
|
Hi,I'm trying to do something very simple, but I can't figure out how to. I have a file like this:text1
text2
text3
...
textxand I need to create a file like this:text1 text2 text3 ... textxThanks for any help!
|
|
|
|
fitz |
04/07/2009 06:32PM
|
|
|
Status: offline
Registered: 09/30/2005
Posts: 4040
|
Assuming your file is called 'test' and you don't care whether there is a newline at the end try:[code:1:5b67f13344]cl> type test | tr STDIN "\n" " "[/code:1:5b67f13344]Otherwise, you could write a little loop:[code:1:5b67f13344]
list = "test"
while (fscan (list, line) != EOF) {
printf ("%s", line, >> "newfile")
}
print ("", >> "newfile")
[/code:1:5b67f13344]This will create the new file called 'newfile' with a terminating newline. You could similarly redirect using the one-liner above and then add a newline the same way.-Mike
|
|
|
|
| |
|
Content generated in: 0.10 seconds |
|