Replace every empty space the beginning and the end

Hi All. I want to use get-content and -replace to replace empty spaces:
The text file
Line1:abcd
Line2:cdef
       Line3:jukq
Line4:casdj

First of all, this isn't relevant to DPM so would have been more appropriate being posted in
http://social.technet.microsoft.com/Forums/windowsserver/en-US/home?forum=winserverpowershell and potentially have a better chance of being replied to before now.
That said, doing what you're after is fairly straight forward, though the exact method depends on what you're trying to achieve.
If you want to update the existing file c:\input.txt so that same file ends up with the spaces removed, then use :
(Get-Content C:\input.txt) |
Foreach-Object {$_ -replace " ",""} |
Set-Content C:\input.txt
Alternatively, if you're trying to load those values into a variable ($foo) but with the spaces removed then you can use :
$foo = (Get-Content C:\input.txt) |
Foreach-Object {$_ -replace " ",""}

Similar Messages

  • Can I replace my iPhone if the ends are cracked?

    Can I replace my iPhone if the ends are cracked?

    Of course it can be replaced..... if the device needs replacement because of a manufacturing issue and is still under warranty it will be replaced at no cost.
    If there is user damage (which is what it sounds like) or the device is out of warranty, Apple offers Out of Warranty replacements.  In the US the costs are $199 for the 4S and $149 for older models.

  • Unable to insert program lines in event sort begin and sort end

    Hello friends,
    I am developing a smartform where in I have to print subtotal for every currencies. So I am unsing the sort criteria option and giving the WAERS in 'Data' tab of the Table . And I select 'Event on Sort Begin' which creates a node in the tree under the table. And I need to clear the total variable in this event so that for every new currency, the total is reset. But I am unable to create a program lines here. When I right click and under  flow logic, only Loop and Command options are available. I am using ECC 6.0 . Kindly help me in achieving the solution.
    Thanks & regards,
    Ratheesh

    Hi Sripaleshwar,
    I tried that.. I am able to create a program lines when I right click on the table. But it always gets placed outside the table node. When I try to drag it also to under the sort begin event node, it says 'Unable to insert program lines at the selected position'. Basically for my logic to work , it has to execute this program lines when the sort begin event occurs.
    regards,
    ratheesh

  • I'm considering buying CC but need to know does it allow me to store photos taken while on location via a laptop and then once I am back home retrieve them in my pc through CC, thus enabling me to keep memory cards empty at the end of each day shooting?

    This would be the main reason for purchasing CC but I can't seem to find the info to answer my question if anyone can help?

    You can place photos in the Creative Cloud Files folder on your computer and they will be synced up to the file storage. You can try a free trial with 2 GB of file storage to see if the system works for you before purchasing.

  • SSRS 2008 R2 report prints empty spaces for html content till end of page

    Hi
    I need to display records containing long html content say each record of different size ranging from 5 lines to 3-5 pages.
    Issue observed is:
    When a record complete is printing say half the page and subsequent record is bigger then half a page, the subsequent record is printed on the next page rather than continue immediately after the previous record is completed.
    Is their any property or any other solution to resolve the issue. Print on next page is not set.
    Nikesh Shah

    Hi Nikesh,
    As per my understanding, I think the issue is caused by the blank space in the report body. In order to get rid of the blank space when print the report, please refer to the following steps:
    Click on Report > Report Properties > Layout tab
    Make a note of the values for Page width, Left margin, Right margin
    Close and go back to the design surface
    In the Properties window, select Body
    Click the + symbol to expand the Size node
    Make a note of the value for Width
    Please check the Page Break settings on all your report items and make sure the Body Width + Left margin + Right margin less than or equal to Page width, just like the equalities below:
    (Body Width + Left margin + Right margin) <= (Page width)
    If there are any other questions, please feel free to ask.
    Regards,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • When I export a PNG file on illustrator, I get random empty space along with my exported object. Is there any way I can make just my object export and nothing more?

    This is an example of my problem. This icon is the sole object in this document, and is the only thing being exported here. Yet when I do export it, a random bar of white space is exported along with it. I am currently using Illustrator to design the art for a video game, meaning that this empty space plays havoc with my end product, and I have to meticulously crop anything I export. Since I do have to make hundreds of individual sprites for this, I would love to learn how to fix this problem and save myself a lot of time. So, what exactly am I doing wrong here, and how can I fix it?

    quicklite,
    I believe the resulting/final size may extend just a tiny bit above a whole point/pixel (value) on the pixel grid.
    You may see by Edit>Preferences>General>Use Preview Bounds (if needed), then select one of the top Reference Points in the Transform palette and look at the Y value measured in points/pixels.
    If that is the case, the solution would be to get rid of that tiny bit.

  • Firefox user agent has an empty parentheses "( )" at the end

    We've noticed that some users hitting our website have an empty ( ) at the end of their user agent string. This is typically where the .net framework asst version info is. We only see it with the latest generation of firefox, 3.6.3, 3.5.9, etc. It seems to have started or gotten much worse around 4/26. Here is an example - "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 ( )" Anyone have any idea what changed? - Thanks
    == roughly 4/26

    oops - didn't mean to post anonymously
    the-edmeister is correct - thank you. The problem is not with my browser, but with some of our users. I'm still searching for the root cause here. We're coding around it but I hate not knowing. I reinstalled Firefox 3.6.3 today on XP and noticed that the microsoft .net framework assistant is disabled. I have an older install of 3.5.9 on windows 7 and on that version I can choose to disable it. This leads me to believe that there are some changes or development going on around this add-on that could account for our problem. I just need to find someone who knows the Firefox code that handles the user agent.

  • Boot camp problem (can't merge empty space)

    Hello everybody.
    After a failed Boot Camp Windows 8 installation my drive has 50 GB empty space (the former partition) that Disk Utility can't merge with the main partition nor format it.
    And if I boot from the USB stick made by Boot Camp, Windows begins the installation, but inmediately reboots and I can't even access to insert the product key.
    I've read about some other utilities that can fix this partition problems (Testdisk, GPT fdisk), but I'm not that advanced user and I think that I have messed up enough.
    Thanks in advance and excuse my english.

    The problem is similar to what is exposed in this post: https://discussions.apple.com/message/19744168#19744168

  • How to delete photos in a folder without causing unintended empty space?

    So I like to keep photos in a typical Finder folder. The thing is, whenever I delete a photo, there's an empty space where that photo used to be. And those empty spaces add up and the result is not too visually appealing. Is there any way to remove all the empty spaces at once? Thanks in advance.

    Try setting a default Sort By setting using COMMAND-J while viewing the window. You can configure other settings as well:

  • Replace '\n' by space

    Dear friends,
    I am developing a project. In which i need to convert a string containing '\n' by space. Can any one of you help me.
    i had tried string.replace also.
    Advance Thanks
    Rengaraj

    Hmmm...
    I wrote that regex the way I did because I didn't want to replace every single space with another single space--a very expensive redundancy. But looking at it again, I see that it won't replace single TABs, formfeeds, etc.. Here's a better way:   str = str.replaceAll("(?! \\S)\\s+", " ");

  • HT3275 I've 1.85TB empty space on my time Machine, but it only backs up to the beginning of the previous month. it should have weekly back-ups for every month before that. Any ideas why it deletes stuff older than a month?

    I've 1.85TB empty space on my Time Machine, but it only retains back-ups to the beginning of the previous month. I should be able to access weekly back-ups for every month before that until the disk is full. Any ideas why it deletes stuff older than a month?
    Thanks, Rigby.

    If you are using Ethernet to connect your Mac to the Time Capsule, are you allowing at least 2-3 minutes for Time Machine to fully load when you open the application to see your backups?
    If you are using wireless to connect, you may need to allow 8-10 minutes or longer for everything to fully load, depending on the speed of your wireless connection.
    If you see only white time "bars" on the timeline at the right of the screen, you are seeing temporary backups. Permanent backups are displayed with purple "bars".

  • I have tried to download a movie via iTunes. Every time the download nears the end, it stops and restarts from the beginning. This has happened 5 times. Any solutions?

    I have tried to download a movie via iTunes. Every time the download nears the end, it stops and restarts from the beginning. This has happened 5 times. How can I clear the download or solve this?

    If it is a HD movie, it may not be enough. The iPad also need working space.
    Try download to iTune (computer) and "Move" to iPad.

  • ApWo S1-6.2.7 Columns NOT linked? + empty space on the bottom of every page

    Hi,
    this is about Apple Works S1-6.2.7:
    * I would like to have a space of about FIVE empty lines on the bottom of EVERY sheet of my manuscript. How is this possible? (Not just ONE line with a number, as for the page number footnotes.)
    * I would also like to write parts of my script in two columns that don´t interfere with each others. That means f ex I would be able to add extra lines in the first column while keeping everything in place exactly as it is in the second column, and vice versa. (That means the texts in the two columns should NOT be linked to each others.) Can anybody help?? (I have tried with a tabell but they don´t continue on to next page when necessary.)
    - A huge thanx for smart solutions!

    A I do not though understand what a WP document is.
    Where do you open that?
    Neither can I find a table at the Tool Palette, I´m
    afraid...
    WP = word processor document (ie. not aspreadsheet, drawing, etc.)
    Show the Tools palette by clicking the red toolbox icon at the lower left of the document window.
    The Table creation tool is one of the group of four at the top of the Tools palette: Text tool, Spreadsheet tool, Paint tool and Table creation tool.
    Click the Table (creation) tool, then drag a rectangular space the approximate size of the table you want. When you release the mouse button, you'll see a dialogue in which you can specify the number of columns and rows in the table. When you click OK, the table will be placed in your document as a Floating object.
    I also have this question:
    B If I have specific headlines here and there
    within a text that are numbered 1, 2, 3, 4, 5 etc.
    and suddenly want a new numbered headline between f
    ex the headlines numbered 3 and 4. How can I make 4,
    5, 6 etc automaticly switch up one number so the
    string of numbers will maintain perfect? Is this
    possible at all? Thank you for good advice!
    Best regards Martin
    Although it might be possible to accomplish this, the game would not be worth the candle.
    Automatic numbering is available only for "paragraphs" and in the preset "Outline" styles. When "paragraph" numbering is set, it applies only to contiguous "paragraphs." If you change the format to allow unnumbered paragraphs, then change back to 'numbers', the numbering is reset to 1 for the first paragraph of the new set.
    ("paragraph" in AppleWorks's understanding of the word is "all the text up to the next return character.")
    You might be able to define an "Outline" style based on one of the three provided Outline styles (Diamond, Harvard, Legal) that would label Level 1 paragraphs with number and apply no label to paragraphs at other levels. If successful, this should automatically renumber the headings if they were inserted as top level paragraphs.
    See "styles", "outline" and "editing styles" in AppleWorks Help for instructions on how to do this.
    I've left Yvan's post here as it appears to have disappeared from this thread (or came from a separate topic).
    Regards,
    Barry
    Try to do that:
    create a new WP document
    insert a page break so the doc will contain two
    pages.
    Create a table from the Tool Palette.
    You may set the row number to a huge value: try 100
    for instance.
    The table will cross the page break.
    In fact, defining a table from the Tool Palette is
    not the same thing that defining one from the menu
    item.
    The menu item creates an inline table (which of
    course is unable to cross a page break) while the
    Tool Palette define a floating one which may be
    higher.
    We may do that. Is it a good thing is another
    question because the application is unable to cut the
    table by itself so the printed result will be odd.
    Yvan KOENIG (from FRANCE mercredi 13 décembre 2006
    20:27:18)

  • Since installing Firefox as my default browser, and removing Internet Explorer 9,which was awful, my Homepage screen is just in the middle of my screen with very small print and empty space on each side of it. Can the be fixed?

    Three days ago I installed Internet Explorer 9 as my browser. When I tried to sign in to my email on my homepage I couldn't.
    I contacted my service provider and they said that Explorer 9 was not compatible with them as it is in Beta form and also in test mode.
    They suggested that I remove Explorer 9 and install Firefox, which I did. Then they said it was a good idea to have more than one browser at a time and to go into the Microsoft site and download Explorer 8.
    I tried this and it would not let me go back to Explorer 8 only forward to 9 which I reinstalled.
    After all of this my Homepage only fills up the middle of my screen and I have empty space on either side of the picture. When I browse, the site I go to opens up to full page, but the print is much smaller than before.
    I don't know what I installed to make my viewing so much smaller or my homepage to shrink.
    Also do I really need 2 browsers or can I just go with Firefox?
    If so, how will not having Internet Explorer affect my browsing?
    Firefox is set as my default browser and I am enjoying using it, I just wish I had my Homepage back to full screen!

    When going to a website the picture was small - tried changing the Zoom size , tried Zoom Reset - the text did change size but the layout distorts - found under View - Zoom - Zoom Text Only was checked --- Removed this check mark and the website returned to normal size and Zoom worked normally again. I am 99.9999% sure I did NOT check this myself and there is no one else on the computer to cause it. Maybe this will help.

  • I backed up then erased 118 gigs worth of photos, but my storage still says I'm full.  I emptied the trash and rebooted but my computer won't recognize the empty space.  What gives?

    I backed up then erased 118 gigs worth of photos, but my storage still says I'm full.  I emptied the trash and rebooted, but my computer won't recognize the empty space.  What gives?  I erased all my iPhoto pictures from the pictures folder in Finder so I could restore a backup from my Time Capsule.  When I try to restore the library, I get a message that there's not enough room on my computer to restore.  I have a Macbook Pro with 250 gig hard drive.  I would greatly appreciate some help.  Thanks!

    If you're trying to add a large amount of data all at once, and you get an alert of insufficient space, then from the menu bar, select
               ▹ System Preferences... ▹ Time Machine
    If the padlock icon is closed, click it to unlock the settings and authenticate. Turn Time Machine OFF, then back ON and close the preference pane. Restart the computer. Test.

Maybe you are looking for

  • Is there an emulator for OS 9.2 that works on 10.4.11?

    Hello, I am running OSX 10.4.11 and I need to run a program that says it will only run on 9.2 or OSX in classic mode. I haven't just tried it yet, as I don't want to spend the money and then find out later I can't get it to work. I've been reading ab

  • Ipod not restoring; error 1418

    my ipod mini has a exclamation mark and a folder sign. I put it to disk mode and connected it to the computer. and it froze up itunes almost everytime. the only time I actually got ipod to show up left side (under library) when I unplugged the ipod a

  • RE: (forte-users) R: (forte-users) ASP andForté

    I think you should also be able to publish the Forte Service Objects as DCOM services. Then you can access them from within VB-scripts. Pascal Rottier Atos Origin Nederland (BAS/West End User Computing) Tel. +31 (0)10-2661223 Fax. +31 (0)10-2661199 E

  • Forum for Cloud Computing.

    Can we have a saperate group to discuss about cloud computing ?

  • I'm new to this- Internet Navigation

    Question: Mobileme web site when i'm using a browser if i put in a word it shows me HITS which have relevance to that word, the web site developer has to put these words into their site on a navigation panel when developing the web site. Does that ex