Quick file formatting help

I have a text file that is formatted as follows:
-0.0016175000
-0.0017733000
-0.0018856000
-0.0019120000
-0.0018445000
-0.0016527000
-0.0013274000
-0.0009151100
-0.0004094200
-0.0001299200
0.0000949790
0.0000043996
-0.0002285200
-0.0002984000
-0.0004567800
-0.0007942500
.....etc to 4096 lines
I would like to format it to 8f9.6 (8 columns, 9 characters per column, 6 decimal places) so that it looks like this : (ignore the numbers)
0.000798 0.000767 0.000724 0.000734 0.000782 0.000795 0.000826 0.000902
0.000979 0.000967 0.000965 0.001138 0.001277 0.001257 0.001289 0.001465
0.001700 0.001913 0.002056 0.002195 0.001990 0.001317 0.000547-0.000331
-0.001186-0.001798-0.002032-0.002070-0.002350-0.002688-0.003055-0.003558
-0.003862-0.003885-0.003795-0.004288-0.005034-0.004921-0.004742-0.004633
-0.004324-0.003811-0.003159-0.003647-0.004038-0.003878-0.004468-0.004487
-0.004155-0.003389-0.002787-0.004875-0.006885-0.008231-0.010034-0.010298
-0.010232-0.009111-0.007179-0.005626-0.002845-0.001475-0.000203 0.003708
0.006822 0.009041 0.009653 0.008051 0.006684 0.003679 0.001132 0.000948
0.000256 0.000046 0.000609 0.002814 0.005005 0.004153 0.004023 0.005317
...etc.
Thank you

Not a beauty, but should work (reads from "file", outputs to standard output).
#! /usr/bin/ruby -w
arr = []
x = 0
File.open("file", "r") do |file|
while line = file.gets
arr.insert(-1,line)
end
end
arr.each do |element|
print sprintf("%9.6f",element)
x = x + 1
puts if x.modulo(8) == 0
end
Last edited by lucke (2009-05-13 23:38:11)

Similar Messages

  • Logo file format help??

    Hi
    I have created a logo in Illustrator, the logo contains 2 pieces of text in 2 different colours, and a symbol made up of 3 of the same shapes all different colours, they all overlap each other, 2 of the shapes have a soft light blending mode, and the 3rd overlay blending mode, (all shapes are 100% opacity) With a transparent background.
    My question is.. what is the best file format to save the logo as, so that I can then place the logo in an Indesign file (for a packaging design) as to keep the transparent background, colours, etc...
    I have also grouped and then flattened the 3 shapes in the logo in Illustrator in order to keep the blending modes just within the logo and not effect the Indesign layout.
    is this the correct way to go about this?
    Thanks for your help
    Ruth

    I concur with Scott: .ai file with PDF compatibility.

  • New Adobe update does not accept Sony NEX .MTS file format - help?!

    I've seen some 'solutions' to this problem but none apply to me. I do not have older versions of Premiere to work with these files and then import into the new Adobe CC 2014. I also tried renaming the file folder with the video files but that does not work for me either - unless there is a step by step process someone can provide so I can see what I am doing wrong.
    Main point is this should not happen in the first place - it has never been a problem with Adobe before.
    .MTS is a very popular file format - many people use the fs100 and fs700, etc.
    ADOBE PLEASE FIX!

    Hi Bmeredit,
    bmeredit wrote:
    I've seen some 'solutions' to this problem but none apply to me. I do not have older versions of Premiere to work with these files and then import into the new Adobe CC 2014. I also tried renaming the file folder with the video files but that does not work for me either - unless there is a step by step process someone can provide so I can see what I am doing wrong.
    Main point is this should not happen in the first place - it has never been a problem with Adobe before.
    .MTS is a very popular file format - many people use the fs100 and fs700, etc.
    ADOBE PLEASE FIX!
    We need more info please: FAQ: What information should I provide when asking a question on this forum?
    Another thing we need to know: how are you importing/ingesting the files?
    Thanks,
    Kevin

  • I'm recording video on JVC HD camera.Every 13:54 it starts a new file.I have one file that won't play.I get this message:Quick time player can't open (names file) because the movie's file format isn't recognized.  Only happens this one file.Ideas?

    I can't open one Quick Time movie file.  It says: Quick time player can't open (names file) because the movie's file format isn't recognized.  Only happens on this one file.  All the others of a two hour shoot are fine. 
    Any ideas what's happened and is there some way to open that file and retrieve what's on it? 

    Thanks this was useful. I have been ripping my audiobooks and I was finding that they would get uploaded to iCloud in the process, which in itself was fine, but then iTunes would not let me change the media type to Audiobook, which is annoying as it effects how iTunes treats the media. Like showing you the skip back 10 seconds button.
    The general outline here helped me work around the issue and change the media type before the media was re-uploaded to iCloud.
    Sean

  • MPEG MPG file formats & quick time player

    hi
    i am new to macbook n my Q is about the MPEG & MPG file formats every time i try to play them using quick time i just have a msg telling me that i cant do so and that quick time played cant open the file. so is there any other program that i can use for mac that can play suck files ??

    Try installing flip4mac for QT. If that doesn't help you can use VLC. It is a nice program.

  • HT3775 MPEG-4 movie the quick time I get the following msg---1080p.mp4" could not be opened. The movie's file format isn't recognized.

    MPEG-4 movie the quick time I get the following msg---1080p.mp4” could not be opened. The movie's file format isn't recognized.
    Is there any way to make the movie work....anybody can help????

    Hi,
    Not all .mp4 items are created equal as there are many subvariants.
    You may want to Install Perian and/or Flip4Mac
    8:57 pm      Monday; January 27, 2014
      iMac 2.5Ghz 5i 2011 (Mavericks 10.9)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad

  • Help needed  while exporting crystal reports to HTML file format using java

    Help needed  while exporting crystal reports to HTML file format using java api(not using crystalviewer).i want to download the
    html file of the report
    thanks

    the ReportExportFormat class does not have HTML format, it has got to be XML. Export to HTML is available from CR Designer only.
    Edited by: Aasavari Bhave on Jan 24, 2012 11:37 AM

  • HT3775 Hi, my mac which is on 10.7.5 osx. but when ever i insert any mpeg/avi video cd it shows the file format not recognized. i am fed up of this. plz somebody help me. what should i do now.

    hi,
              i am using 10.7.5 lion there are a lot of problems in this OS.
    like most of the programs quit's unexpectedly. some programs does not work on it. like adobe cs5 is not working. everytime time when i do click on adobe cs 5 icon it shows a message "To open “Adobe Photoshop CS5,” you need to install a Java SE 6 runtime, but you are not connected to the Internet.To install a Java SE 6 runtime later, open “Adobe Photoshop CS5” again" while i always remain connected on the net.
    2. when ever i insert an avi or mpeg video disk it shows the file format not recognized. to **** with this macbook pro n its 10.7.5 lion. the same disk works/runs on windows on windows systems.
    plz somebody help me what should i do now.
    [email protected]

    it sounds like a fualty installation of Lion, this may happen from time to time.
    The best thing to do in this situation is to reinstall Lion. You will not loose anything doing this, but you should always keep back ups of your information.
    http://www.apple.com/osx/recovery/
    basically hold Cmd+R on boot..
    first go to disk utility, verify and repair your disks and permissions. Exit out of Disk utility and then go directly to "reinstall Lion"
    choose that and let it reinstall.
    Adobe CS6 does need Java to run.
    To play your movies you might need to get an application called VLC. VLC is a free app and will play most videos and music files you throw into it.
    http://www.videolan.org/vlc/download-macosx.html
    you have a 64bit intel mac, so get the one for that.

  • HELP! Unexpected File Format Error

    I was recently working on a project in Flash CS5.5 for school, last thing i did was save the project and close the program. Next time I try to open it I get an error saying "Unexpected File Format", and the application closes itself out. I can open Flash by itself and work on anything else, but when I try to open my class project it repeats the same thing "Unexpected File Format" and closes. The file was originally started IN Flash CS5.5, and has not moved to any other program since then. I dont understand what happened. I really need this project working again, can anyone help?

    It's just happened again!!
    This is really killing my deadline.  Same file, this time I had just deleted to fonts from the library, then clicked save to get the alert to kill flash.
    This time I got the additional info from the "Adobe Flash CS5.5 has stopped working" alert box:
    Problem signature:
      Problem Event Name: APPCRASH
      Application Name: Flash.exe
      Application Version: 11.5.0.325
      Application Timestamp: 4d79fed5
      Fault Module Name: Flash.exe
      Fault Module Version: 11.5.0.325
      Fault Module Timestamp: 4d79fed5
      Exception Code: c0000005
      Exception Offset: 00131e35
      OS Version: 6.1.7601.2.1.0.256.4
      Locale ID: 2057
      Additional Information 1: 0a9e
      Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
      Additional Information 3: 0a9e
      Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
    Read our privacy statement online:
      http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409
    If the online privacy statement is not available, please read our privacy statement offline:
      C:\Windows\system32\en-US\erofflps.txt
    Then after clicking "Close the program" on the alert, I get another alert with the following in the problem details:
    Problem signature:
      Problem Event Name: APPCRASH
      Application Name: Flash.exe
      Application Version: 11.5.0.325
      Application Timestamp: 4d79fed5
      Fault Module Name: ntdll.dll
      Fault Module Version: 6.1.7601.17514
      Fault Module Timestamp: 4ce7b96e
      Exception Code: c0150010
      Exception Offset: 00083f7e
      OS Version: 6.1.7601.2.1.0.256.4
      Locale ID: 2057
      Additional Information 1: aba5
      Additional Information 2: aba5168922f519834928ffedc4428eb5
      Additional Information 3: a36e
      Additional Information 4: a36ebf3985e5b9460741b16a785caa1b
    Read our privacy statement online:
      http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409
    If the online privacy statement is not available, please read our privacy statement offline:
      C:\Windows\system32\en-US\erofflps.txt

  • Ibook G4 using iPhoto 5. Some photos in library cannot be opened.               An error -couldn't open file. it may be corrupt or a file format that preview does not recognize.  HELP!!

    I have an ibook G4 using iphoto5.  Some photos in my library cannot be opened.  It hasn't always been this way.  I have tried to click and drag to a folder in finder and when i do i get an error !Coundn't open the file. It may be corrupt or a file format that Preview doesn't recognize.  Can anyone help in solving this problem?

    The only solution to corrupted files is to restore from your back up.
    Regards
    TD

  • I just used stellar phoenix mac data recovery and it seemed to work but now my files won't open.  Even though they are "jpeg, mov" files the error message is  could not be opened. The movie's file format isn't recognized. "  Any help or are they corrupted

    I just used stellar phoenix mac data recovery and it seemed to work but now my files won't open.  Even though they are "jpeg, mov" files, the error message is  "could not be opened". The movie's file format isn't recognized. "  Any help or are they corrupted?

    Sounds to me like the file is probably corrupt. If you had hard drive corruption or damage, that could easily result in recovered files not being fully intact. If you were trying to recover accidentally deleted files, it's possible they might have been partially overwritten before recovering. There are never any guarantees with file recovery.
    Without more information on the circumstances that led you to try recovery, it's hard to give advice on what to try from here. You could always try another file recovery tool, like Data Rescue 3. Just be sure you're taking appropriate precautions when doing recovery. See Recovering deleted files.

  • I updated my pages app on my ipad and when I tried to open a document it says the file format is invalid. None of my documents are opening pleaser help!

    I updated my pages app on my ipad and when I tried to open a document it says the file format is invalid. None of my documents are opening pleaser help!!!!

    Try this. It worked for me.
    I discovered the same problem.  I had an older version of Pages on my iPad. After updating it to the latest version all my previous documents created in pages for the iPad were rendered unreadable and a message stated that they were an invalid format.  Why for the life of me would a program that was created by Apple and sense updated not be able to read previous versions...well that's a whole other sad story.  Any way I discovered how to fix it but it would require that you had backup your iPad on a computer and not emptied your trash. If this sounds good than here is how you fix it... And it worked for me.
    These steps will enable you to reinstall a previous version of the Pages app so you can be able to read and edit older documents.
    FIRST: if you did backup your iPad using your computer and did not empty your trash, GOTO the trash and look for PAGES 1.4 (or other number) ipa ( that's the file extension) ie PAGES 1.4 ipa.
    SECOND: move that file out of the trash and onto your desktop.  Once you do this, double click on it and a box will come up stating a newer version has been found and do you want to revert back to older version. ANSWER YES. It will than automatically place and overwrite the older version back into the file on iTunes that contains the rest of your backed up apps.
    THIRD: and this is where it is important that your backup would have to have been on your computer. I'm not sure if backup on the cloud will work.  iCloud backup at your own risk And here's why. Before you restore you will need to remove the latest version of Pages off your iPad by doing the usual : holding down the home button until the apps wiggle and remove by pressing on X on app.  Removing off your iPad will also delete all your documents but if you have a previous backup on your computer those documents will be stored safely on itunes and will return.
    FORTH: plug your iPad into your computer and allow it to sync so iTunes will recognize it. Once iTunes is up and you can see that it recognizes your iPad, GOTO "FILE/DEVICES/RESTORE FROM BACKUP."  ******* DO NOT CLICK ON BACKUP***** click on RESTORE FROM BACKUP. This will reinstall all previous settings and documents that were their when you backuped PLUS the older version of Pages that you placed back from the above steps. Let it run through all the setups ( this could take up to 20 minutes...depending on amount of data and photos and apps).
    FIFTH: Once everything is reinstalled a message will popup on your computer stating "to leave iPad plugged in until iTunes recognizes it again" ( it's basically rebooting itself).  Once done (leave iPad plugged in still) GOTO iPad and follow the steps. IMPORTANT:  iPad will ask you if you want to SET IT UP AS A NEW IPAD, BACK UP FROM THE CLOUD or BACK UP FROM ITUNES.....press SET UP AS NEW IPAD. Follow all of the steps required. Once complete GOTO iTunes on computer, look for "IPAD" plus a little arrow ( should be on upper right corner of iTunes window, click on it ( this will safely disconnect your iPad from iTunes) . Now unplug iPad from computer and go to your iPad and look for the older version of Pages. It should be there along with all your old documents ( readable and editable too).
    Hope this helps. Good luck.

  • Help needed with File Formats (Save As...)

    Somewhere upgrading versions of Photoshop (Mac), some old File Formats have remained. The result is that I cannot properly select a File Format to Save As... except the native PSD format. Others have to be selected by selecting a format below the one on the list, meaning that I cannot select TIFF because there are no formats below this one. (Accepted formats http://help.adobe.com/en_US/photoshop/cs/using/WSfd1234e1c4b69f30ea53e41001031ab64-7758a.h tml#WSfd1234e1c4b69f30ea53e41001031ab64-7754a)
    I've looked in the Plugins folder and there are no strange file formats there. I checked Library>Application Support>Adobe>Plug-Ins but nothing there. I've tried searching the entire hard drive for Compuserve GIF (one of the offending file formats) but nothing matches.
    I give up trying to figure out where some of the problem plugins are located. As you can see from the image below, selecting Multi-Picture Format actually will save it as a jpg. From reading Adobe's formats, I think CompuServe GIF is causing part of the problem. I don't know what other one.
    Or it may be that I just need to reset something so all formats are properly recognized. Can anyone help?

    Curt,
    That is great information. Unfortunately I've already checked the preferences and do not have an additional plugin folder specified.
    Suppossedly, according to the information from Adobe, the only place plugins should be loaded is in the Photoshop > Plug-Ins folder, or possibly Library>Application Support>Adobe>Plug-Ins (according to the link you provided). There is nothing there.
    When I look at Photoshop > About Plug-ins I see that, for example, there are two (2) versions of CompuServe GIF format. Obviously one is old from a previous install/update, but I cannot find it anywhere. If I could find it, I could remove it. I suspect that is one of the conflicts causing my problem, but I see no way in Preferences to remove a plug-in. The link you gave says to move it outside the folder, but it presupposes you can even find the offending plug-in, which I cannot.
    Monty

  • Excel cannot open the file beacuse the file format or file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file [help]

    Hi,
    I have a excel file that I have been using since beginning of year.
    Yesterday, I tried to open it but a message comes out "
    Excel cannot open the file beacuse the file format or file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file"
    After I click yes, the page is blank. The file is about 400kb in size.
    I have try open and repair and third party repair program and not working also.
    I would appreciate a lot if you can help me.
    Thank you very much.

    Per your post, this problem might be caused by malware on the affected machine.
    http://blogs.technet.com/b/the_microsoft_excel_support_team_blog/archive/2013/09/07/quot-cannot-open-the-file-because-the-file-format-or-extension-is-invalid-quot-opening-office-files.aspx
    In order to clean your machine, run Microsoft Safety Scanner (http://www.microsoft.com/security/scanner/en-us/default.aspx) to kill the malware, and then repair Excel file itself.
    If this is not the case, feel free to post back and let me know. Thanks.
    Tony Chen
    TechNet Community Support
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • HT3775 why can i not open the file format MPEG_4(mp4) on my mac with Quick player?

    i can not open the email with file format MPEG_4(mp4) which is one of the contents on the file format listing , supporting by Quick time player but still can not be opened . !!!!!!!!! by the way my quick time player version:10.2(603.6)

    The file extension, .mp4, .wmv, .mov, etc. really has no bearing on whether it can play or not. It should, but that is not the way it works. The file type is merely a wrapper around the media content. That media content can be encoded with lots of different encoding algorithms. If it is encoded with a scheme that Quicktime doesn't understand, then it won't play in Quicktime Player.
    You might try installing the Perian plugin for Quicktime. It might have the codecs necessary to decode the media content.
    Another option is to use Video LAN's VLC. It plays a lot of things.

Maybe you are looking for

  • How to get a file name with file description

    Hi guys! I'm receiving the error message : Too many file open. So, i want the file name opened by process in /proc/PID/fd. Now, how can i do this ? Thanks!

  • Cannot Update Windows 7 while connected to my WRT54G.

    For some reason the computers that are connected via wired or wireless through my WRT54G Vers. #6 (Firmware Version v1.02.8) will not connect for updates (Error Codes: 80072EE2-Win7, 80072EFD-Vista) especially OS, anti-virus, malware updates.  This l

  • Bottom Left Corner of Finder

    Hi peoples, This is probably a stupid question, but what is the icon in the bottom left hand corner of Finder? It's only there in certain windows, like Documents and Pictures. It looks like four diamonds/parallelograms in a grid. Here's a screenshot-

  • 'notes' has disappeared on my iMac, how do i re-install it?

    I have 'Notes' on my MacBook Pro (10.8.3) my iPhone 5S (6.1.4) and my iPad (6.1.3) but not on my intel iMac (10.7.5). Can anyone explain where it has gone to and how I get it back? Thanks

  • Ipod shuffle does not repond any more

    The ipod has worked for four months, though i havent used so frequently. And to day it does not respond any more or can not be found when inserted in may mac (OSX) or my pc (XP), they have both "high-power USB" and "high-speed USB", have also tried i