Unable to remove 'r'n from file

Currently have a folder with numerous files.  Each of these files needs to have the CRLF removed from the end of each line.
line1
line2
line3
results
line1line2line3
the follow code, doesn't produce any error, but doesn't replace them;
get-childitem -File 'pathofdirectory' |
 select -expand fullname |
  foreach {
            (Get-Content $_) -replace "`r`n", '' |
             Set-Content $_            
why is this not replacing the CRLF with nothing?

Add-content "C:\Test.txt" "Line1"
Add-content "C:\Test.txt" "Line2"
Add-content "C:\Test.txt" "Line3"
Add-content "C:\Test.txt" "Line4"
get-childitem 'C:\Test.txt' |
select -expand fullname |
foreach {
$Lines = (Get-Content $_)
$S=""
$Lines | % { $S += $_}
[System.IO.File]::WriteAllBytes($_,(([system.Text.Encoding]::ASCII).GetBytes($S)))
Get-Item C:\Test.Txt
Get-Content C:\Test.txt
Directory: C:\
Mode LastWriteTime Length Name
-a--- 06/11/2014 12:00 PM 20 Test.Txt
Line1Line2Line3Line4
No CRLF at end, file length should be 20

Similar Messages

  • Unable to remove this item from GRIR.  It was a consignment PO receipt done

    Hi Guys,
    The user saying that"unable to remove this item from GRIR.  It was a consignment PO receipt done improperly, so it needs to be deleted".
    Because of this the the material documet which shows $6725.43-(Negative) in GRIR account.when i check this this transation was originated through MI10(Physical inventory differenvces posting).May be user done wrongly.
    Now the problem is this
    -          how this transaction originated?
    -          Why is this posted to GR/IR account?
    -          How do we correct the open item in the GR/IR account?
    -          What need to happen to rectify the mistake?
    can any tell me how can we do this,i will be greatful to u.
    Thanks&Regards,
    Babu,
    09930154536

    Hi Jurgen,
    when i check the material document and accounting document,it was showing that said amount in negative sign and transaction done by MI10 means posted differences with out reference to document.
    it means the user may entered wrongly i think.
    was there any GRIR account for MI10?
    MI10 does not have reversal or cancel?
    so how to resolve it?
    as per my idea it can be done by FI posting.
    please help to resolve.
    Thanks in advance.
    Regards,
    Babu
    09930154536

  • Unable to remove a host from VMM - Error (2606) Unable to perform the job because one or more of the selected objects are locked by another job.

    I am unable to remove a host from my Virtual Machine Manager 2012 R2. I receive the following error:
    Error (2606)
    Unable to perform the job because one or more of the selected objects are locked by another job.
    Recommended Action
    To find out which job is locking the object, in the Jobs view, group by Status, and find the running or canceling job for the object. When the job is complete, try again.
    I have already tried running the following command in SQL Server Management Studio
    SELECT * FROM [VirtualManagerDB].[dbo].[tbl_VMM_Lock] where TaskID='Task_GUID'
    I received this error back:
    Msg 8169, Level 16, State 2, Line 1
    Conversion failed when converting from a character string to uniqueidentifier.
    I have also tried rebooting both the host and the Virtual Machine Manager Server.  After rebooting them both, I still receive the same error when trying to remove the host.
    Here are my server details
    VMM Server OS = Windows 2012 Standard
    VMM Version = 2012 R2 3.2.7510.0
    Host OS = Windows 2012 R2 Datacenter
    Host Agent Version = 3.2.75.10.0
    SQL Server OS = Windows 2012 Datacenter
    SQL Version = 2012 SP 1 (11.0.3000.0)

    Hi there,
    How many hosts are you managing with your VMM server?
    The locking job might be the background host refresher job. Did you see any jobs in the jobs view, when the host removal job failed?
    If there is no active jobs in the jobs view when this host removal job fails, can you please turn on the VMM tracing, retry the host removal, and paste back the traces for the failed job (search for exception and paste the whole stack)?
    Thanks!
    Cheng

  • Apple TV unable to remove tv shows from favorites

    After the latest upgrade I am unable to remove tv shows from favorites and when I rearrange the icons they go back to the previous order after a few minutes.  Is anyone having this issue?  Any ideas on a resolution or is this just another of the many bugs in the latest release?

    Hi arnie9,
    If you are having unusual interface behavior with your Apple TV after a recent update, you may find the following article helpful:
    Apple TV (2nd and 3rd generation): Restoring your Apple TV
    http://support.apple.com/kb/ht4367
    Regards,
    - Brenden

  • Unable to remove mozilla folder from C:\Users\Username\Appdata\

    We're trying to remove Firefox as its messing with the roaming profiles on the server,
    we're unable to remove the following folders
    c:\program files (x86)\mozilla firefox
    c:\users\username\appdata\mozilla,
    error message says need permission from administrators (we're logged in as full domain administrator)

    The problem lies in the administration patches. Somewhere one or more of the security updates was missed or ignored. The admin pointers to the permissions on the stack in the HAL layer are pointing to a NULL field. This is a common problem with MS(c) based OS's. Solutions: (1) Remove and Re-apply security updates in order. (2) reload and allow the OS' to catch all the updates. (3) Scream at MS(c) until they tell you what update you missed.

  • Remove address bar from file explorer (using regsitry)

    This used to be possible in 2008, but I haven't been able to figure out how it's done in 2012 R2. The old method was to add a key under IE, and it would also remove the address bar from windows explorer - but this method
    no longer works. So is anybody aware of what key needs to be changed or modified in order to make this happen. Further, ideally this change would happen in HKCU.
    Thanks

    Hi,
    >>That would seem to remove run from start menu, not the address bar from file explorer.
    Yes, this setting will disable Run.exe. However, this setting will also prevent users from accessing local or network resources by typing the accessing paths in the address bar of File Explorer.
    I am not completely sure why you want to remove the address bar in File Explorer. However, if our target is to restrict users from accessing network resources by UNC path, in my opinion, enabling this setting a better way to go.
    In addition, regarding this topic, the following thread can also be referred to for more information.
    Hide Windows Explorer Address Bar
    http://social.technet.microsoft.com/Forums/en-US/987305c6-bd48-4107-bcf5-84d4fff4097d/hide-windows-explorer-address-bar?forum=winserverGP
    Best regards,
    Frank Shen

  • Removing "LineFeed" character from file

    Hi,
    I have a scenario where I need to develop an EJB session bean business method which will take a file (inputstream) as input.
    The methods should remove all "LineFeed" characters in this file and return new file (inputstream).
    How do I achieve this? How do I remove line feeds from inputstream?
    Thanks and regards,
    Amey

    This is how its done:-
    import java.io.*;
    public class RemoveLineFeed{
         private static final String BLANK = "";
         private static final String NEWLINE = "\n";
         private static final String CARR_RET_NEWLINE = "\\r|\\n";
         private static final String LINE_SEPARATOR = "line.separator";
         public static void main(String[] args){
              InputStream l_returnStream = null;
              String l_inputStreamAsString = null;
              byte[] byteArray = null;
              try{
                   //1. InputStream to String
                   FileInputStream fileInputStream = new FileInputStream ("997AND824-TESTFILE_WithLF");
                   DataInputStream dis = new DataInputStream(fileInputStream);
                   int arraySize = fileInputStream.available();
                   byteArray = new byte[arraySize];
                   dis.readFully(byteArray);
                   l_inputStreamAsString = new String(byteArray);
                   //2. Carry out replace
                   //l_inputStreamAsString = l_inputStreamAsString.replaceAll(NEWLINE, BLANK);
                   //l_inputStreamAsString = l_inputStreamAsString.replaceAll(System.getProperty(LINE_SEPARATOR), BLANK);
                   l_inputStreamAsString = l_inputStreamAsString.replaceAll(CARR_RET_NEWLINE, BLANK);
                   //3. Convert String back into InputStream
                   //l_returnStream = new ByteArrayInputStream(l_inputStreamAsString.getBytes());
                   //4. Create new file
                   File l_outFile = new File("997AND824-TESTFILE_WithOutLF");
                   FileWriter fileWriter = new FileWriter(l_outFile, true);
                   fileWriter.write(l_inputStreamAsString);
                   fileWriter.close();
              catch (IOException ioe) {
                   System.out.println(ioe.toString());
              catch (Exception e) {
                   System.out.println(e.toString());

  • Remove LF characters from file names

    I have a folder full of files with filenames that contain LF character (ASCII code 10).  I want to use Automator's "Replace Text" funcion to remove these non printing characters from file names.  Is there a way to do it?
    If automator is not able to do this task, I will take a bash script or applescript solution as well...

    Take a look at: http://stackoverflow.com/questions/4417588/sed-command-to-fix-filenames-in-a-dir ectory
    (I changed  tr -d "\r\n" to tr -d "\n", but try both)
    for f in ~/Desktop/*
    do
        new="$(printf %s "$f" | tr -d "\n")"
        if [ "$f" != "$new" ]; then
            mv "$f" "$new"
        fi
    done

  • Removal of TABS from File Upload

    Hi all,
    I made an upload of a local file with TAB spaces in an internal table .I am required to remove the TABs from the records.I tried to used command REPLACE '/h' by single space, where '/h' being the TAB , but it did not work.
    How can I achieve the requirement?
    Your ideas are appreciated
    Thanks,
    stock

    first you wil call GUI_UPLOAD in normal way.
    <b>if you are in UNICODE system,</b>
    CLASS CL_ABAP_CHAR_UTILITIES DEFINITION LOAD.
    CONSTANTS: X_DELIM  TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
    this X_DELIM is to store HORIZANTAL TAB value.
    <b>if you are in a NON UNICODE SYSTEM,</b>
    you can use,
    data X_DELIM type x value '09'.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          FILENAME                = V_FNAME
          FILETYPE                = 'ASC'
        TABLES
          DATA_TAB                = IT_READFILE
        EXCEPTIONS
          FILE_OPEN_ERROR         = 1
          FILE_READ_ERROR         = 2
          NO_BATCH                = 3
          GUI_REFUSE_FILETRANSFER = 4
          INVALID_TYPE            = 5
          NO_AUTHORITY            = 6
          UNKNOWN_ERROR           = 7
          BAD_DATA_FORMAT         = 8
          HEADER_NOT_ALLOWED      = 9
          SEPARATOR_NOT_ALLOWED   = 10
          HEADER_TOO_LONG         = 11
          UNKNOWN_DP_ERROR        = 12
          ACCESS_DENIED           = 13
          DP_OUT_OF_MEMORY        = 14
          DISK_FULL               = 15
          DP_TIMEOUT              = 16
          OTHERS                  = 17.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        EXIT.
      ENDIF.
    *--Delete any Empty lines in the input file,if any
      DELETE IT_READFILE WHERE LINE IS INITIAL.
      LOOP AT IT_READFILE INTO X_READFILE.
        SPLIT X_READFILE-LINE AT X_DELIM
                            INTO  X_INPUTFILE-F1
                                 X_INPUTFILE-F2
                                X_INPUTFILE-F3.
        APPEND X_INPUTFILE TO IT_INPUTFILE.
        CLEAR X_INPUTFILE.
      ENDLOOP.
    HERE IT_INPUTFILE IS the internal table with your fields.
    IT_READFILE IS a character type internal table
    data : BEGIN OF IT_READFILE occurs 0,
              LINE(1000) TYPE C,
            END OF IT_READFILE.
    or you can put HAS_FIELD_SEPERATOR = 'X' in calling the above function module.
    Regards
    Srikanth
    Message was edited by: Srikanth Kidambi

  • Unable to remove 'cifs preposition' from WAE

    Hi.
    I created a 'cifs preposition' using the CLI on the WAE instead of doing this on the Central Manager and now I am unable to remove it, I keep getting this error below when I use the 'no' command.
    Here is the config and steps I am taking and the error I receive:
    accelerator cifs preposition 19927
       name "remove"
       server "10.10.12.90"
       root "repository/REGIONS/"
       credentials username xxxx domain xx password xxxxxxx
       max-cache 2
       no ignore-hidden-dir
       no recursive
       scan-type since last
       schedule
       no enable
       modified 19:09:2012 09:51:58
    exit
    When I try to remove using the following: WAE1(config)#no accelerator cifs preposition 19927 I receive the error below.
    "config: spawnp: verify binary file: /ruby/bin/echo: No such file or directory
    Error spawning user process '/ruby/bin/echo': No such file or directory"
    Thanks
    Zubair

    Peter,
    As always thanks for taking time to respond. Indeed your method is correct and worked.
    I do agree with your sentiments, this is an "ugly cosmetic problem", Cisco should keep a standard which we all used by using 'no' to negate the command.
    Thanks for your help.
    Regards
    Zubair

  • Unable to remove credit card from Apple Pay

    I'd like to remove my credit card from the Apple Pay application on my iPhone 6. The instructions say to touch the card in the Passbook and then click on the "i." Then scroll down and touch "Remove Card." I tried that but the Remove Card link is not "hot," that is, nothing happens when I touch it.
    Any suggestions or "work-arounds" to remove my card from the application?

    I only had one card in Apple Pay and I decided to remove it. I did ao without issue. I did it on my iPad Air 2, not on my iPhone 5S which does not have Apple Pay. My point is that I only had one card in Apple Pay, not multiple cards.
    Do you have any restrictions set that would prevent account changes. Settings>General>Restrictions.

  • Shared Services 11.1.2 Unable to remove assigned user from a security group

    In Shared Services 11.1.2 - trying to remove a user from the assigned users list of a security group. Initially, I am able to remove the user and the assigned users total decreases by one - but when I relaunch the group properties - this user is still in there? The change does not hold. Any suggestions would be appreciated - thanks,
    Paul

    Hello Paul,
    Not sure if this is related to yours, but it might be worth having a look at the following articles on Oracle support --
    External users in EPM Shared Services (e.g. MSAD users) cannot be removed from Native groups if they have multiple IDs in the external user directory. [ID 1526569.1]
    Users from External User Directories Cannot be Removed from Native Groups [ID 1272309.1]
    Thanks,
    hyperionEPM
    Please mark answers as correct or helpful for others to find them easily.

  • Unable to remove my photo from outgoing email

    I was playing with Photobooth, and somehow I inadvertently changed some setting that results in a photo of myself being attached to every email message I send. Nowhere in Help does it tell me how to undo that. In fact, I would like to remove the photo from my Admin account also. When I sign into it to make changes, there is no way to do that. Any ideas??

    I couldn't figure out a way to remove it, but I made it disappear by taking a small screen shot (command-shift 4) of a white space in a document. This creates a photo which you can then choose in Addressbook or your Accounts Pref. pane to replace the unwanted photo that appears in sent mail. It's still there but you can't see it.

  • Forms Designer - Unable to remove Child Table from the form

    Hello,
    While testing adding additional attributes, I have assigned an additional child table to the form. However I am not able to remove it. I get an error message: "This version has been made active. Add/Update/Delete not allowed."
    I tried creating new version and making it active to remove 'active' status from the form I modified, but still getting the same error. What am I doing wrong? Thank you in advance.

    creating new version and making it active to remove 'active+'
    Make new version then remove child form and then make version active..
    You are making version active b4 removing child table.
    Don't change the sequence which I have written above.

  • Unable to remove billing block from an Sales order.

    Hi Team,
    I'm cleaning return order that still blocked from long time ago till 2009 and I have a few of them that I cannot release the block because I'm getting an error message and don't allow us to get into VA02. Error--(Date 01/03/0001 is before the beginning of factory calendar XC). I tried to remove factory calendar from customer master but still I am getting an error message. so is there any standard programme to remove the block or any other method ?
    Thanks
    Sits

    The problem here is not that you cannot remove the block but that the document cannot be edited in general. My guess is that some change occurred in the system since the documents were created (either configuration, master data or a new user exit).
    If the document cannot be modified in VA02, I doubt it would be possible to modify it in any other transaction (because they all, essentially, end up calling the same functionality). I would suggest to debug the code to see where exactly the message occurs. It may also be possible to bypass the message in debugger and proceed with the change. I wouldn't recommend this as general practice, but it might work as an exception.
    Also you might want to consider archiving with deletion instead (use Search), if the documents are very old.

Maybe you are looking for

  • How do I clone my computer's MAC address on to the AE base station?

    This is just driving me nuts. I've looked at responses to this question on the internet, and it appears that the Airport Extreme Base Station can't perform a function that nearly all WAN home routers have been able to perform for a decade: "cloning"

  • Mac Mini and Bluetooth

    Is there any other way that I can use the Bluetooth Module with out buying the complete AirPort Extream/Bluetooth Kit and without using the Bluetooth Dongle? Mac Mini 1.42 MHZ Combo Drive   Mac OS X (10.3.9)   512 MB DDR 80 GB HD

  • Mobile Phone Related Questions

    Q#1:- what is difference between xenon flash,LED flash and Dual-LED flash? Q#2:- which one is better among these three? Q#3:- what is NFC? Regards. Malik Mohammad Talish Awan B.A Eng. AAASP The Scorpion

  • Removing credit card number from my account

    How do I remove my credit card number from my account.  My son who is 8 lost his iPod touch or gave it away and I would like to cancel my account so that my credit card is not charged for any apps.

  • Controlling Join Path in OBIEE

    I have a dimension table that is the central "hub" of our physical data model. That dimension is joined to 4 different fact tables. I have a query/graph from a previous project release (all was working fine) that only references 2 of those fact table