Remove the last comma before reading csv files

Hello

I'm working on a VI that reads a lot of files csv (created by an application) using the built-in "worksheet File.vi reading" before combining in a report by using the excel report generation tool. 'All lines' are read in the csv file by using the worksheet File.vi reading.

There are cases of csv files, where there an unwanted comma to the end of the line and an extra cell (with no data) appears in the final report. I was wondering if there is an easy way to remove it (rather than passing through each line and get rid of it).

Thank you!

You will need to go through each line, look at the last element and delete it if it is an empty string.  But a loop, it's easy:

Read the spreadsheet, get 2D array of strings.  For each line, download the last element.  Test if she is a Virgin.  If so, remove it from the table.  If this is not the case, switch the blank table.

Tags: NI Software

Similar Questions

  • Script to remove commas from a csv file

    Hi all

    I have the following output to a csv file:

    VM, VI-SVC-VM014, 0000ed, 0000ee,
    VM, VI-SVC-VM103, 0000f3, 0000f2,
    VM, VI-SVC-VM104, 0000f6, 0000f6,
    LDEV, SVC PROD Cluster01, 0000e2, 0x04
    LDEV, SVC PROD Cluster01, 0000de, 0x00
    LDEV, SVC PROD Cluster01, 0000df, 0x01
    LDEV, SVC PROD Cluster01, 0000e2, 0x04

    I'm looking to remove commas end so that the output looks like this:

    VM, VI-SVC-VM014, 0000ed, 0000ee
    VM, VI-SVC-VM103, 0000f3, 0000f2
    VM, VI-SVC-VM104, 0000f6, 0000f6
    LDEV, SVC PROD Cluster01, 0000e2, 0x04
    LDEV, SVC PROD Cluster01, 0000de, 0x00
    LDEV, SVC PROD Cluster01, 0000df, 0x01
    LDEV, SVC PROD Cluster01, 0000e2, 0x04

    The column length for each line (given the number of objects), modular in this output. By this, I mean that some outputs will be like this:

    VM, VI-SVC-VM014, 0000ed, 0000ee, 0000ef
    VM, VI-SVC-VM104, 0000f6, 0000f6

    VI-SVC-VM104, 0000f6, 0000f5, 0000f7, VM, 0000f4
    LDEV, SVC PROD Cluster01, 0000e2, 0x04
    LDEV, SVC PROD Cluster01, 0000de, 0x00

    Is it possible to import the data (get-content), delete all non alpha-numeric end of line? Maybe there is an easier way.

    Thank you

    Rob.

    Try something like

    Get-Content file.csv | %{
      $_.TrimEnd(',')
    } | Set-Content newfile.csv
    
  • How can I edit a wav file and remove the last 10 minutes?

    I have a wav file which is an hour of time.  I want to remove the last 10 minutes.  Can I do this with Windows Media Player?  How?  Thank you very much, I am very low tech.

    The freeware "Audacity" should be able to do this:
    Audacity: <> http://audacity.sourceforge.net/ >

    HTH,
    JW

  • Remove the last element

    Hello

    I'm removing the last element in a LL individually. But it's not entry (method deleteFromTail) and also a message delete2 which I have not written anywhere in my print program... I don't have the code running on any other computer.

    Javax.swing import. *;

    Class StudNode {}

    int id;

    The name of the string;

    Next StudNode;

    StudNode (int id1, String name1) {}

    ID = id1;

    name = name1;

    }

    }

    public class StudListDel2 {}

    StudNode head, tail;

    StudListDel2 () {}

    head = tail = null;

    }

    Sub create4ElementList () {}

    Add them to the queue

    int id = 1;

    int i = 0;

    String name = "THIS" + id;

    StudNode newNode;

    newNode = new StudNode (id, name);

    head = newNode;

    tail = newNode;

    for (i = 0; i < 4; ++ I) {}

    ID ++;

    name = "THIS" + id;

    newNode = new StudNode (id, name);

    tail. Next = newNode;

    tail = newNode;

    tail. Next.Next = null;

    }

    }

    Sub display4List () {}

    tail = head;

    {while(tail!=null)}

    JOptionPane.showMessageDialog (null, "name =" + tail.name + "id =" + tail.id);

    tail = tail.next;

    }

    }

    Sub deleteFromTail () {}

    If only a single node in the list

    JOptionPane.showMessageDialog(null,"delete***=1");

    / * If (head == tail)

    head = tail = null;

    else {}

    JOptionPane.showMessageDialog(null,"delete***=2");

    StudNode temp.

    Temp = head;

    While (temp.next! = tail) {}

    Temp = temp.next;

    JOptionPane.showMessageDialog (null, "led2 inside while" + tail.name + "id =" + tail.id);

    }

    tail = temp;

    tail. Next = null;

    JOptionPane.showMessageDialog (null, "delete3 =");

    }

    */

    }

    Public Shared Sub main (String [] args) {}

    StudList obj = new StudList ();

    obj.create4ElementList ();

    obj.display4List ();

    JOptionPane.showMessageDialog (null, "deleteOOO1 =");

    obj.deleteFromTail ();

    JOptionPane.showMessageDialog (null, "deleteFFF4 =");

    obj.display4List ();

    }

    }

    Someone please guide me.

    Zulfi.

    Hello

    His work. I can't believe. I just changed the name of the file from StudListDel2.java to StudListDel3.java & changed the name of class, he began to work.

    I don't know if the logic is correct. But the logic is correct because I follow the logic of deletion of a book that I used 'while' Loop instead of "for". If any body having time, please read the code of void deleteFromTail () { is correct or not so that I shouldn't be passing wrong information.}

    The complete code is:

    public class StudListDel3 {}

    StudNode1 head, tail, last;

    StudListDel3 () {}

    last = Chief = tail = null;

    }

    Sub create4ElementList () {}

    Add them to the queue

    int id = 1;

    int i = 0;

    String name = "THIS" + id;

    StudNode1 newNode;

    newNode = new StudNode1 (id, name);

    head = newNode;

    last is tail is newNode;

    for (i = 0; i<4; ++i)="">

    ID ++;

    name = "THIS" + id;

    newNode = new StudNode1 (id, name);

    Last.Next = tail. Next = newNode;

    last is tail is newNode;

    tail. Next.Next = null;

    }

    }

    Sub display4List () {}

    tail = head;

    {while(tail!=null)}

    JOptionPane.showMessageDialog (null, "name =" + tail.name + "id =" + tail.id);

    tail = tail.next;

    }

    }

    Sub deleteFromTail () {}

    If only a single node in the list

    JOptionPane.showMessageDialog(null,"delete***=1");

    If (head is tail)

    head = tail = null;

    else {}

    JOptionPane.showMessageDialog(null,"delete***=2");

    StudNode1 temp.

    Temp = head;

    JOptionPane.showMessageDialog (null, "first and foremost remove * = 3");

    While (temp.next! = last) {}

    JOptionPane.showMessageDialog (null, "Inside all-in-1");

    Temp = temp.next;

    JOptionPane.showMessageDialog (null, "inside led2 while name =" + temp.name + "id =" + temp.id);

    }

    last is tail is temp;

    Last.Next = tail. Next = null;

    JOptionPane.showMessageDialog (null, "delete3 =");

    }

    }

    Public Shared Sub main (String [] args) {}

    StudListDel3 obj = new StudListDel3 ();

    obj.create4ElementList ();

    obj.display4List ();

    JOptionPane.showMessageDialog (null, "deleteOOO1 =");

    obj.deleteFromTail ();

    JOptionPane.showMessageDialog (null, "deleteFFF4 =");

    obj.display4List ();

    }

    }

    Thanks for your reply. Its really beneficial when we see the flow back of great programmers like you. I'm not a programmer.

    Zulfi.

  • Remove the last Chr (13) &amp; Chr (10) of a string

    Hello, all.

    I am trying to get confirmation of the files to download on Amazon for its program "Charge when ship".  I have the file create as it should with one minor exception.

    I'm creating a variable, giving him the information header column and that finishing by Chr (13) & Chr (10); I'm a loop in a query to add information, each iteration bugs Chr (13) & Chr (10) at the end of it; I'm taking this variable and writing data to a file using CFFILE.

    But I think that the last Chr (13) & Chr (10) is that servers Amazon think there is a line of information that it really is, and it's one mistake.

    Can someone tell me how to remove the last Chr (13) & Chr (10) of the variable before writing this file?

    Thank you

    ^_^

    What gives the information header column and that finishing by Chr (13) & Chr (10); I'm a loop in a query to add information, each iteration bugs Chr (13) & Chr (10) at the end of it; I'm taking this variable and writing data to a file using CFFILE.

    Trim() the variable or modify the code, so it does not generate an extra newline.

    Because your content has a header, place the new line at the beginning of each iteration of the query characters.

    #headerColumnsHere #.

    #chr (13) ##chr (10) # #ColumnA # ColumnB #... etc...

  • WHEN UPDATING WE REMOVE THE LAST?

    I OFTEN IGNORE UPDATE OF WINDOWS, BECAUSE THE FILES ARE QUITE LARGE AND I'M AFRAID THAT WITH ALL THESE UPDATES, THE COMPUTER WILL RUN MEMORY OR SPACE.  WE REMOVE THE UPDATE TO UPDATE A MORE RECENT VERSION?

    STILL CONFUSED

    Monday, March 11, 2013 07:43:15 + 0000, cynthiaO wrote:

    I OFTEN IGNORE UPDATE OF WINDOWS, BECAUSE THE FILES ARE QUITE LARGE AND I'M AFRAID THAT WITH ALL THESE UPDATES, THE COMPUTER WILL RUN MEMORY OR SPACE.  WE REMOVE THE UPDATE TO UPDATE A MORE RECENT VERSION?

    Ouch! Please do not yell at us. We can hear you if you type normally,
    in different cases.

    Number of points:

    1 many updates are essential to your safety, and you play
    with fire if you do not install them. Please do not ignore the.

    2 updates do not use memory (or at least, they use only one very)
    small amount of memory). Disk space is what they use.

    3. even the amount of disk space they use is low and so a update
    requires you to run out of disk space, that you have enough disk space.
    and need to buy a second hard drive or replace what you have with a
    cotyledon. What is your car, and how it is free?

    4. do not remove the last update when you install a newer version. You
    need to keep all installed updates. Thus, for example, if update 1
    protects you from A threat and update 2 protects the threat of B,
    keep the 1 update when you install update 2. If you do not, you will be
    exposed to a threat all over again.

  • I need to export the address book in unicode csv files. When?

    My address book contains Chinese and Korean names. Their special characters get lost when I export the address book to a CSV files to import them from Open Office.

    It is true that Chinese and Korean characters are not maintained when you use the export into csv format, but I tried an example with the option provided by MoreFunctionsForAddressBook and it seems to work fine.

    Select an address book in the address book, then make a right click, MFFAB/Export/as csv (.csv).

  • EqualLogic - remove the last member of the Group

    I want to remove the last member of a pool.  Data has been moved to the other pools.  Will I need to use the reset directly related to the table command?  It is also the default pool but I understand that I can not remove the default pool and it's ok.

    Hello

    If there are yet other members of the group, then NO, please do not use "reset".   That is only used when it is the only member of the Group overall.   You always use the option 'remove member '.  Either through the user interface or the CLI.

    Any pool can be designated as the "default".

    Kind regards

    Don

  • My printer will not remove the last print job

    My printer will not remove the last print job and does not meet what I already found on internet support

    Hello

    If you haven't done so already, try the following.

    From the desktop, hold down the Windows key and press R.  In the run window, type services.msc and press to enter.  Scroll down to the print spooler service, right click and select Properties, then click the Stop button.  Now search for C:\Windows\System32\Spool\PRINTERS, then delete the work inside this folder - you may need to click a command prompt to get the authority to open the PRINTERS folder.

    Restart the computer and you should find that the document has been deleted.

    Kind regards

    DP - K

  • Remove the last sms progrmatically

    How to remove the last progrmatically of sms? Is it possible to do so.

    There is no access to stored sms messages

  • my laptop suddenly stopped to connect to any bluetooth device. I restored my system and removed the programs installed before having this problem.

    my laptop suddenly stopped to connect to any bluetooth device. I restored my system and removed the programs installed before having this problem.

    Hi sh8kdown,

    Thanks for posting this question in the Microsoft Community!

    I understand that you can not connect to Bluetooth devices on the computer. I'm sorry for the inconvenience caused to you. Rest assured that I will do my level best to help you.

    (1) what is the brand and model of the computer?

    (2) what is the model number of the Bluetooth devices?

    (3) you get an error message?

    (4) did you of recent changes to the computer before the show?

    I suggest the following methods and check if it helps to solve the problem.

    Method 1: Open the hardware and devices Troubleshooter

    http://Windows.Microsoft.com/en-us/Windows7/open-the-hardware-and-devices-Troubleshooter

    Method 2: Troubleshoot issues with Bluetooth devices

    http://Windows.Microsoft.com/en-us/Windows-Vista/troubleshoot-problems-with-Bluetooth-enabled-devices

    (Applicable to Windows 7 as well)

    Method 3: Error: "Pilot of Bluetooth device not found" when you try to connect a bluetooth device: http://support.Microsoft.com/kb/2654568 

    Reference:--

    Add a Bluetooth device to your computer: http://windows.microsoft.com/en-US/windows7/Add-a-Bluetooth-enabled-device-to-your-computer

    Change settings for a Bluetooth compatible device:

    http://Windows.Microsoft.com/en-us/Windows7/change-settings-for-a-Bluetooth-enabled-device

    It will be useful. For any other corresponding Windows help, do not hesitate to contact us and we will be happy to help you.

    Kind regards!

  • How to configure Adobe Reader to the default program to read PDF files after you install Adobe Acrobat?

    How to configure Adobe Reader to the default program to read PDF files after you install Adobe Acrobat? I have a few other programs that need to use Adobe Reader showing 'photo' that are PDF files, and after the installation of Acrobat, it is Acrobat that opens automatically, with a message whenever Acrobat cannot be used for this and will be closed, and then the Player opens. I don't like having to see this message every time... Thank you! :-)

    Hi anne-grethea26777033,.

    You can do CD player as your default application by browsing in Edition > Preferences > under categories, select the "Général" and at the bottom of the window, you must select an option which reads "set as default PDF Manager" under the label of startup application and click OK.

    Let us know if that helps.

    Concerning

    Sarojini

  • Hi, I have 0xc0000142 error when I start the first pro after the last update, before that I had no problem playing first pro...!

    Hi, I have 0xc0000142 error when I start the first pro after the last update, before that I had no problem playing first pro...!

    Hello Gene,

    You may need to check this: Re: Premiere Pro 2015 won't open after the recent update

    Kind regards

    Navdeep Pandey

  • How can I remove the last action in my story in Lightroom 5

    I want to remove the last action of my story. I know that Ctrl Z is back, but the action is still there

    Hey Vic,

    Please follow the below items for the same.

    Adobe Photoshop Lightroom 4 * cancel the setting of the image

    When to use Reset and history to undo your Lightroom develop work | Lightroom training Laura shoe, tutorials and tips

    Kind regards

    ~ Mohit

  • What to do in the last hours before 'showtime '.

    Currently, as I get ready to sit the exam on Monday at 15: 15 EST, I'm going through all my gear.  Review of the Guide of the Certification VCP510 by Bill Ferguson.  Go to details in my physical vLab and using what I've learned and studied to improve its design.  I'm nervous, I'm afraid.  I want this so much and yet I fight my fear all tests.  I'm cut off comments at midnight tonight then spend all Sunday making the practical examinations.

    My question is... I'm following a good path for the preparation?   What did each of you in the last hours before the time of the exam?  I make a mountain out of a molehill?

    I really need advice here... something to help my mind to be less fearful and more productive.  All wisdom is greatly appreciated.

    Good luck with the exam.

    BTW. There is always something to learn. I downloaded Unitrends backup earlier to see what it can do. That said, be careful with you answer by e-mail, I just deleted your contact data of your last post

    André

Maybe you are looking for