Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    May 2015
    Posts
    24
    Thanks
    3
    Thanked 1 Time in 1 Post

    Replace new lines and tabs

    Hey everyone,

    I'm trying to open and clean some text files.
    How can I find and replace newlines and tab characters with an empty string.

    Thanks

  2. #2
    Super Moderator
    Join Date
    May 2005
    Location
    Southern tip of Silicon Valley
    Posts
    3,362
    Thanks
    2
    Thanked 234 Times in 227 Posts
    You can use a regex.
    Code:
    $str =~ s/[\t\n]+//g;

  3. #3
    New Coder
    Join Date
    May 2015
    Posts
    24
    Thanks
    3
    Thanked 1 Time in 1 Post
    thanks


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •