Trying to email the last 10 lines of a file in the body of an email

Hi All:
Total PS n00b here.
I'm using PS 2.0 - I am using the "Get-Content | Select -last 10" on a logfile that I want to email. I got the email to work, but the formatting is lost (it's a Robocopy log that lists the details of what got copied/skipped/etc.)
Is there a way to retain the formatting of the last 10 lines?
Thanks for any feedback. 

Thanks for the suggestions, everyone. I was able to get it closer using "Select-Object -last 10|%{"$_ <br/>"}. Remember, I'm using PS 2.0 & "-Tail" & "-last 10" wouldn't work w/out "Select-Object".
I had a friend who had a PS script that does $msg.IsBodyHTML = $true and it got it closer.
Here's what it supposed to look like outta Robocopy:
               Total    Copied   Skipped  Mismatch    FAILED    Extras
    Dirs :       897         0       897         0         0        
0
   Files :      8389      2877      5512         0         0      1396
   Bytes : 266.891 g 107.766 g 159.125 g         0         0 110.255 g
   Times : 109:33:28   6:35:33                       0:00:00   0:27:11
   Ended : Mon Jan 19 21:27:45 2015
===============================================================================
And here's what I got:
Total Copied Skipped Mismatch FAILED Extras
Dirs : 897 0 897 0 0 0
Files : 8389 2877 5512 0 0 1396
Bytes : 266.891 g 107.766 g 159.125 g 0 0 110.255 g
Times : 109:33:28 6:35:33 0:00:00 0:27:11
Ended : Mon Jan 19 21:27:45 2015
==============================================================================
I'd like to get the numbers to line up w/their columns & my manager says he prefers it in the body & not an attachment, but I tried tommymaynard's suggestions, but I don't know how to tell it to overwrite an existing file.
Thanks again, all. I will make sure to push for installing PS 4, as it looks like there's more flexibility in it.

Similar Messages

  • Read in the last line of a file

    Can I use the "Read from File " vi to read ionly the last line of the file? If so, how? Thanks in advance for the help
    [email protected]

    Reading the "last line" of a file implies that you are dealing with an humanly readable ASCII text file and there are special characters (/n or /r or a combination of the two) that signify line breaks.
    You can only start reading from a certain byte offset using file I/O. Unless all your lines are equal lenght, It is impossible to find the start of the last line without reading every character leading up to it in one way or another.
    So in the most general case, you would need to read the entire file and find the last linefeed.
    HOWEVER: Typically, lines are not infinitely long, so if you have an upper estimate of line lenght, you can read a slightly longer tail from the end of the file and find the last linefeed there. You can probably modify the VI I posted here for your purpose, just use an appropriate length. Message Edited by altenbach on 06-08-2005 10:42 AM
    LabVIEW Champion . Do more with less code and in less time .

  • [svn:osmf:] 14412: Added the Syndication. swc to the command line build config file for the AkamaiPluginSample project .

    Revision: 14412
    Revision: 14412
    Author:   [email protected]
    Date:     2010-02-24 17:48:22 -0800 (Wed, 24 Feb 2010)
    Log Message:
    Added the Syndication.swc to the command line build config file for the AkamaiPluginSample project.
    Modified Paths:
        osmf/trunk/apps/samples/plugins/AkamaiPluginSample/AkamaiPluginSample-build-config.xml

    I think it is not supported through ant script and you may have to contact Oracle Support. Please go through below thread (hisaak's reply) -
    Re: Export OSB configuration jar file using Ant
    Regards,
    Anuj

  • Read to get the last line from a File

    Hi
    I am sending in a clarification , hoping that I get an efficient solution from the group, should somebody have come across this scenario and implemented.
    How to read or get the last line from a text file , which usually have a no of records, without actually reading or looping through all the lines
    I know there is some solution with the RandomAccessFile, but given there can be some encoding issues or so.
    Please let me know if somebody have implemented the same.
    Thanks n advance

    The character encoding could, indeed, be an issue especially with UTF-8. I think what I'd do is to create a byte array with the encoded, expected end of line sequence in it and work on the file in bytes. For example, seek to the last 100 bytes of the file, read those bytes and look for an EOL sequence backwards. If not found read the previous 100, 200, 400 bytes etc. until you do find an end of line. Then seek to after the EOL and read normally. Remember an EOL sequence might cross a boundary.
    UTF-8 would be a problem, especially with a unix format file because you might mistake part of a multi-byte sequence for '\n'. To be reliable on UTF-8 you'd need to go back three characters looking for sequence start markers (has the previous character got the top bit set, or the one before that the first two bits set, or the one before that the top three bits). Or you could just react to an encoding exception and try another position.

  • I work a long list. Each line has a link that I click on to work. I then click submit. It does not return to the last line worked. Goes to the begining.

    I go to the Insurance Auto Auction website to access a list of vehicles up for auction. When using "explorer" I can follow the link and set a bid value then click submit. It will return me to the last position on one the list. Firefox will sometimes doe this too but more often than not it brings me back to the top of the list. When I am looking at 300 units this becomes very frustrating.

    Try opening each link in a new Tab, and when you're done with each Tab, close it. The "list" page will be sitting exactly where you left it, ''unless that page did an automatic refresh to add newer information while you were viewing a different tab.''
    Middle-click a link
    or use { Ctrl + click }
    or right-click and use Open Link in New Tab

  • Regarding spaces in the last in of TXT file in the outbound interface

    Hi ,
        I am doing one outbound file, which will have 100 characters length, But last 25 characted i have to fill spaces. When i m trying to fill those 25 chatacters with spaces its not working, i tryed by creating a variabnle of 25 chracted space, still it is not working. Here below i gave the example program....
    data: wa_detailed(100) type c.
      wa_detailed+0(1) = 'suresh'.
      wa_detailed+70(5) = 'welcom'.
      wa_detailed+75(25) = '                        ',.
      append wa_detailed into ist_download.
      This is my program, i m unable to fill those spaces.
    can any one respond asap.
    Thanks,
    Suresh

    It may not be possible to append spaces in any of the variable. E.g. if you look at write statement, it does not allow us to write spaces. Instead, you can have an end of file character like '$' which is placed at 101st position. Look at the below code:
    wa_detailed+0(1) = 'suresh'.
    wa_detailed+70(5) = 'welcom'.
    wa_detailed+100(1) = '$'.
    This way you can transfer first 100 characters to the outbound file.
    Let me know if you have any further queries.
    Don't forget to mark helpful answers!
    Gaurav Parmar.

  • How do I get the top lines i my toolbar back? The top line starting with 'file' on the right and the second line which contained the refersh button as well as the search bar have disappeared. How do I get them back?

    The first two lines of my toolbar have gone. I'm left with most visited but the lines above, containing the refresh button, bookmarks and search bar and above that containing the links to files etc have gone, how do I get em back?
    == I was fiddling with the different bars and must have clicked sth I shouldn't have.

    Alt V
    T
    M
    Be sure to do this in a new blank tab.

  • Need help with java File IO ( Removing the first line from a file )

    Hi guys ,
    I am currently doing a project in which I need to extract out the values from the second line of a file to the end. The question is how do I ignore the first line ??
    I thought of two possible answers myself. One is to use randomaccessfile to read and rewrite. But the file may be HUGE so storing the whole file in memory is not a very good idea.
    Second is to jump to second line before doing while ((str = in.readLine()) != EOL) ... or just delete the first line from the file. Can anyone suggest a better solution or show me some sample codes ? Thanks.
    regards
    billyam

    Just skip the first line (bufferedReader.readLine()), add a comment, and then handle the rest of your file

  • Only the last line item is shown in main window...

    Hello Experts,
    I created a custom form for the standard checque program RFFOUS_C. Now, in my MAIN window, I
    called a subroutine in a custom program which loops through the line items but the problem is
    only the last line item is being shown. I tried using CONTROL_FORM to create a new line
    but it does not work. Note that I did not customize RFFOUS_C since it is being used by
    multiple companies. Below is my code:
    SAPSCRIPT:
    510-C
    Begin of insertion DEVK940799 11/10/2008 DEL_HIDALGO
    DEFINE &LTYC_XBLNR& = ''
    DEFINE &LTYC_BLDAT& = ''
    DEFINE &LTYC_SGTXT& = ''
    DEFINE &LTYC_DMBTR& = ''
    PERFORM WRITE_LINE_ITEMS IN PROGRAM Z9999RFI_Z2574FFI_RA
    USING &REGUH-LAUFD&
    USING &REGUH-LAUFI&
    USING &REGUH-XVORL&
    USING &REGUH-ZBUKR&
    USING &REGUH-LIFNR&
    USING &REGUH-VBLNR&
    CHANGING &LTYC_XBLNR&
    CHANGING &LTYC_BLDAT&
    CHANGING &LTYC_SGTXT&
    CHANGING &LTYC_DMBTR&
    ENDPERFORM
    PROTECT
         &LTYC_XBLNR&     &LTYC_BLDAT&     &LTYC_SGTXT&     &LTYC_DMBTR&
    ENDPROTECT
    End of insertion DEVK940799 11/10/2008 DEL_HIDALGO
    PROGRAM:
    IF gt_regup[] IS NOT INITIAL.
        CALL FUNCTION 'OPEN_FORM'
           EXPORTING
    *         APPLICATION                       = 'TX'
    *         ARCHIVE_INDEX                     =
    *         ARCHIVE_PARAMS                    =
    *         DEVICE                            = 'PRINTER'
    *         DIALOG                            = 'X'
             form                              = lcc_z2574ffi_ra
    *         LANGUAGE                          = SY-LANGU
    *         OPTIONS                           =
    *         MAIL_SENDER                       =
    *         MAIL_RECIPIENT                    =
    *         MAIL_APPL_OBJECT                  =
    *         RAW_DATA_INTERFACE                = '*'
    *         SPONUMIV                          =
    *       IMPORTING
    *         LANGUAGE                          =
    *         NEW_ARCHIVE_PARAMS                =
    *         RESULT                            =
           EXCEPTIONS
             canceled                          = 1
             device                            = 2
             form                              = 3
             OPTIONS                           = 4
             unclosed                          = 5
             mail_options                      = 6
             archive_error                     = 7
             invalid_fax_number                = 8
             more_params_needed_in_batch       = 9
             spool_error                       = 10
             codepage                          = 11
             OTHERS                            = 12.
        IF sy-subrc <> 0.
    *        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    *                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        LOOP AT gt_regup INTO lw_regup.
          m_line_items 'LTYC_XBLNR' lw_regup-xblnr.
          m_line_items 'LTYC_BLDAT' lw_regup-bldat.
          m_line_items 'LTYC_SGTXT' lw_regup-sgtxt.
          m_line_items 'LTYC_DMBTR' lw_regup-dmbtr.
          DELETE ex_output WHERE value IS INITIAL.
          CALL FUNCTION 'WRITE_FORM'
           EXPORTING
             element                        = '510-C'
             function                       = 'APPEND'
    *         TYPE                           = 'BODY'
             window                         = 'MAIN'
    *       IMPORTING
    *         PENDING_LINES                  =
           EXCEPTIONS
             element                        = 1
             function                       = 2
             type                           = 3
             unopened                       = 4
             unstarted                      = 5
             window                         = 6
             bad_pageformat_for_print       = 7
             spool_error                    = 8
             codepage                       = 9
             OTHERS                         = 10.
          IF sy-subrc <> 0.
    *        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    *                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
          CALL FUNCTION 'CONTROL_FORM'
            EXPORTING
              command   = 'NEW-LINE'
            EXCEPTIONS
              unopened  = 1
              unstarted = 2
              OTHERS    = 3.
          IF sy-subrc <> 0.
    *        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    *                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
        ENDLOOP.
        CALL FUNCTION 'CLOSE_FORM'
    *       IMPORTING
    *         RESULT                         =
    *         RDI_RESULT                     =
    *       TABLES
    *         OTFDATA                        =
           EXCEPTIONS
             unopened                       = 1
             bad_pageformat_for_print       = 2
             send_error                     = 3
             spool_error                    = 4
             codepage                       = 5
             OTHERS                         = 6.
        IF sy-subrc <> 0.
    *        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    *                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
      ENDIF.

    Hi,
    Write the at last event in the program and check if it works
      At last.
           CALL FUNCTION 'CONTROL_FORM'
            EXPORTING
              command   = 'NEW-LINE'
            EXCEPTIONS
              unopened  = 1
              unstarted = 2
              OTHERS    = 3.
          IF sy-subrc  0.
           MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
    Regards,
    Sravanthi

  • JSP for Vcard cannot strip carriage return in the last line of the file.

    I am using JSP to output a Vcard (http://en.wikipedia.org/wiki/VCard)
    The following code works great in Windows but fails on the mac:
    <%@ page contentType="text/x-vcard" %><%--
    --%><%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %><%--
    --%><%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %><%--
    --%>BEGIN:VCARD
    VERSION:2.1
    <c:choose><%--
    --%><c:when test="${not ((empty param.lan) and (empty param.fin)) }"><%--
    --%>N:${param.lan};${param.fin}
    FN:${param.fin} ${param.lan}
    </c:when><%--
    --%><c:otherwise><%--
    --%>FN:${param.org}
    </c:otherwise><%--
    --%></c:choose><%--
    --%>ORG:${param.org}
    TITLE:${param.title}
    TEL;WORK;VOICE:${param.phwork}
    ADR;WORK:;;${param.st};${param.city};${param.state};${param.zip};
    EMAIL;PREF;INTERNET:${param.email}
    REV:20080424T195243Z
    <c:out value="${fn:replace('END:VCARD','\\\r','')}" escapeXml="false"/>After some tests, I discovered that Mac (I used Tiger, latest update, not Leopard) needs extra white space and carriage returns stripped off. Once this is achieved, the vcard will automatically import into Address Book. I have followed other forums which advice on using JSP comments as in the code above. But for some strange reason the last line of the JSP outputs an extra carraige return. How do I get rid of the carriage return at the end of the file? the replace function from JSTL is not working.
    Edited by: shogo2040 on Dec 18, 2008 7:11 PM : I added more detail to the Subject

    I originally had that END:VCARD without any carriage return.
    But I still get an extra carriage return at the end when the JSP renders to VCF
    I'm using Tomcat running on Linux.
    I found this, article which implies (but does not explicitly say) JSP in general adds a newline to the last line:
    http://www.caucho.com/resin-3.0/jsp/faq.xtp (But its not tomcat either, so maybe this info is irrelevant).
    Edited by: shogo2040 on Dec 22, 2008 3:31 PM - changed rendered to VCF from rendered to JSP

  • How to read a file and save the line number of  the last line read?

    Hi,
    I am using RandomAccessFile and file as my class. I am trying to read a log file as it gets updated and print it out to a java window. i so far have the framework setup but dont know how to save the last line number so.
    i need this variable so i dont reprint out the same line numbers to the java window. please advise.
    thanks!

    hi,
    i now have the line number of the last line read, but now when i reopen the file, how can i skip that number of lines?
    thanks,

  • How to set a JScrollPane always display the last line?

    I have put a JTextArea in a JScrollPane.
    Whenever I append a new line of sentence to the JTextArea, the JScrollPane only shorten the vertical scroll bar.
    Is there any command that can scroll down to the last line whenever I append a new sentence to the JTextArea?

    I have tried to add the line you shown, but it can just show the second last line. It cannot scroll down to the last line.
    e.g. I have these message:
    AAA
    BBB
    CCC
    If the message board can only show 3 lines and I enter one more line "DDD", then the last line will be shown is CCC. I need to scroll down a bit more myself to see DDD. If I scroll to the top and enter another line"EEE", it will scroll down to show "DDD" but not "EEE".

  • My Deskjet 1056 cuts the last line off of the page

    My Deskjet 1056 cuts half the last line of every page off. No matter what I'm printing from where. I've tried changing margins and printing areas and borders. I've heard to try changing the drivers to 990c or 450 . neither make a difference. Changing the port from bidirectional makes it worse. Even tried to change the print processor modes. No luck. Does anyone have any suggestions. When I print and alignment page the squares at the bottom print just fine and align the page just fine so that doesn't help either. I run on Windows7 I don't know if that has anything to do with it. PLEASE HELP. Thanks in advance

    Hi ! Welcome to the HP Forums. I understand you are having an issue with printouts being cut off at the bottom when printing to your HP Deskjet 1056 All-in-One printer from your Windows 7 computer. I'd love to help you with this. The first thing I would suggest would be to make a copy on the printer itself. If the bottom of the page is cut off, then it could be an issue with the hardware. If the copy comes out fine, then we know the hardware is functioning properly. If the copy comes out fine, I would suggest installing the full feature software for you printer if you haven't already. You can download the software here: HP Deskjet Full Feature Software and Drivers If that doesn't resolve the issue please download and run the HP Print and Scan Doctor and let me know of any errors or messages you receive. Have you tried printing multiple documents? Or printing from alternate programs to see if it might be an issue with a specific document or program? I look forward to hearing back from you and working towards a resolution. Thanks for posting!

  • How to keep unaltered the last line?

    Hi I am doing some last corrections in a book which is going to be in the next days published and I am not allowed to change the form of the pages. (The indexes at the end of book are already done). Thus by correcting some footnotes (making them shorter) the main text above also changes (the first line of the next page appears in the page I corrected the footnotes) and I cannot keep the previous form of the pages. How can I keep the last line of the main text unaltered so that the pages turn exactly at the same point like before?

    If I am understanding your issue correctly, it seems that you are trying to keep the length of each page's main content  unaltered so that the index could refer back to the correct page.  It sounds like the content in each page's frames are linked, so that they flow continuously.  Adding a page break (or a frame break) may be what you're looking for.  You'll find it under Type > Insert Break Character.
    I hope this helps.  And good luck with your book!

  • How to remove the last line input into a string indicator??

    I am currently working on a program where the user has the ability to create a profile for one of our lab machines to run.  When the user selects what parameters they would like, a string indicator shows the user the last input they set followed by a comma.  For example, if the user selects which profile they want, and the times they would like to set, the following string would be displayed:
    As you can see in the picture above, the profile is updated in the string indicator after every set button is hit.  In the event the user makes a mistake, I want them to have the ability to delete the last line that was added.
    This is the code I developed so far.  The string coming in and leaving is attached to a shift register so it continues to append to the indicator.  I tried in this case to count how many lines have been written in the string so far, and I built an array with the current string.  Using the delete from array.VI I indexed it to the number of lines that was created so that the last line is deleted.  I unfortunately had no luck.  Any suggestions?

    tbob wrote:
    Fonzie1104 wrote:
    Hey Tbob,
    That almost worked.  The only issue though is it leaves a null string in its place without moving everything after up one line.  Also, if i have a parameter repeating multiple times, it doenst seem to work.
    I'm confused.  If you are deleting the last line, how can there be anything after?  What do you mean by a parameter repeating multiple times?
    If you look at my example front panel, you will see that the last line is deleted.  Isn't this what you asked for?
    It's due to the fact that your constant doesn't have a comma in the last line. If you add that in, you should be able to reproduce his problem. This is just a guess though, I didn't actually test it to see.
    Message Edited by for(imstuck) on 06-08-2010 01:24 PM
    CLA, LabVIEW Versions 2010-2013

  • SQL window keep scrolling down to the last line

    Is there a setting that will keep the SQL window from always scrolling down to the last line in the window? This feature is very annoying when trying to review code that is longer that the window size.

    You'd have to give more details as to what's your environment and what exactly is failing, but FWIW my tables' SQL tabs behave the same as all others; they start up scrolled up, and can be scrolled as you whish...
    K.

Maybe you are looking for

  • Oracle 10.2.0.4 cannot find sdo_georaster

    Hello, I got a machine (installed by others), when I tried to create sdo_georaster object: SQL> create table t1(id number, img mdsys.sdo_georaster); create table t1(id number, img mdsys.sdo_georaster) ERROR at line 1: ORA-00902: invalid datatype 1. S

  • I saved a vital mailbox but it is now encrypted - how and how to I get it in a readable format?

    I am using a Mac OX10 with Mountain Lion.  I saved a vital mailbox to an original document file but it turned out encrypted.  How can I get it into normal format? why did this happen?

  • How to manipulate instances?

    Hi, I am having trouble manipulating instances of xml loaded pictures. I want to change their x and y position and tween them etc. I have loaded them onto the stage from an xml file, and given them all individual names but the most I can do now is ei

  • Firefox 4 opens a new firefox window for every tab I open

    Everytime i open Firefox 4, all my old saved tabs are opened in their own new window in addition to being put on my tab bar. Each new instance of the windows has all access to all the other tabs from the original window as well

  • JMS-130 JMS queue cannot be multi-consumer enabled

    error: queue = ((AQjmsSession)t_sess).getQueue("tmp", "tmp_queue"); pl/sql code: BEGIN DBMS_STREAMS_ADM.SET_UP_QUEUE( queue_table => 'tmp_queue_table', queue_name => 'tmp_queue'); END; BEGIN SYS.DBMS_AQADM.CREATE_AQ_AGENT( agent_name => 'explicit_dq'