Link to home
Start Free TrialLog in
Avatar of Computer Guy
Computer Guy

asked on

How Do I Make This On 1 Line?

I have multiple lines of the same thing.

I could also use Notepad ++

#TIME:13:53
D:\Live\Phish\NYE 2011\2011-12-31 II New York, NY\02 - Phish - Light.mp3
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

I don't understand the question.
I'm assuming you have a textfile, with multiple lines that look like this:

#TIME:13:53
D:\Live\Phish\NYE 2011\2011-12-31 II New York, NY\02 - Phish - Light.mp3
#TIME:13:53
D:\Live\Phish\NYE 2011\2011-12-31 II New York, NY\02 - Phish - Light.mp3
#TIME:13:53
D:\Live\Phish\NYE 2011\2011-12-31 II New York, NY\02 - Phish - Light.mp3
#TIME:13:53
D:\Live\Phish\NYE 2011\2011-12-31 II New York, NY\02 - Phish - Light.mp3
#TIME:13:53
D:\Live\Phish\NYE 2011\2011-12-31 II New York, NY\02 - Phish - Light.mp3
#TIME:13:53
D:\Live\Phish\NYE 2011\2011-12-31 II New York, NY\02 - Phish - Light.mp3
#TIME:13:53
D:\Live\Phish\NYE 2011\2011-12-31 II New York, NY\02 - Phish - Light.mp3
#TIME:13:53
D:\Live\Phish\NYE 2011\2011-12-31 II New York, NY\02 - Phish - Light.mp3
#TIME:13:53
D:\Live\Phish\NYE 2011\2011-12-31 II New York, NY\02 - Phish - Light.mp3
#TIME:13:53
D:\Live\Phish\NYE 2011\2011-12-31 II New York, NY\02 - Phish - Light.mp3
#TIME:13:53
D:\Live\Phish\NYE 2011\2011-12-31 II New York, NY\02 - Phish - Light.mp3
#TIME:13:53
D:\Live\Phish\NYE 2011\2011-12-31 II New York, NY\02 - Phish - Light.mp3

Open in new window

(Perhaps with slightly different text or timestamps, but the pattern is the same)

You should use Notepad++ for this.

- Open the text file in Notepad++
- Open the "Replace" dialog box by pressing CTRL+H
    * Set the search mode to "Regular Expression"
    * untick the ". matches newline" checkbox
    * "Find What" should be:        
(#TIME)(.*)(\r\n)(.*)(\r\n)

Open in new window

   * "Replace With" should be:    
\1\2 \4\5

Open in new window

This will replace this pattern:

"#TIME", then a bunch of characters, then a newline, then a bunch of characters, then a newline  

with this pattern:

"#TIME", then a bunch of characters, then a SPACE, then a bunch of characters.

It essentially will strip out the line break inbetween the two lines.
Avatar of Computer Guy
Computer Guy

ASKER

I have a playlist in txt format that has this for 50 songs (different ones though)

#TIME:13:53
D:\Live\Phish\NYE 2011\2011-12-31 II New York, NY\02 - Phish - Light.mp3
#TIME:13:53
D:\Live\Phish\NYE 2011\2011-12-31 II New York, NY\02 - Phish - Light.mp3
#TIME:13:53
D:\Live\Phish\NYE 2011\2011-12-31 II New York, NY\02 - Phish - Light.mp3

Want to make it like this:
Column 1      Column 2                                                                     Column 3
#TIME:13:53 D:\Live\Phish\NYE 2011\2011-12-31 II New York, NY\02 - Phish - Light.mp3
Okay let me revise my original statement:

Find What:
(#TIME)(.*)(\r\n)(.*)(\r\n)

Open in new window

Replace With:
\1\2, \4\5

Open in new window


(added a comma into the "replace with" box)

This will give you three columns, separate by commas, which you can now import into excel.

Keep in mind that Excel might get confused if your filenames actually contain a comma, it will throw off the parser. It will probably be fastest for you to just manually fix those occurrences, if  any.
I tried that, it gave me 2 columns. I really want the 02 - Phish - Light.mp3 portion in a new column
That means you need a pattern that finds the last backslash on the second line, and wraps the fields in doublequotes so that Excel doesn't get confused by the comma in your album name.

That's a bit tricker. I'll test out a few things and get back to you.
ASKER CERTIFIED SOLUTION
Avatar of Frosty555
Frosty555
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Cool. Few more then.

Make: 13 - Gwen Stefani - Crash.mp3 TO "Gwen Stefani", "Crash" (omitting 13 - and .mp3)

Make: Avicii - Le7els.mp3 TO "Avicii", "Le7els" (omitting .mp3)
Hi,

I did the following. How can I do this not that the songs / artists are in their seperated columns.

Also, It's easier for me to do all of the renaming all over again, that's fine too. I still have my origianal files.

Make: 13 - Gwen Stefani - Crash.mp3 TO "Gwen Stefani", "Crash" (omitting 13 - and .mp3)

Make: Avicii - Le7els.mp3 TO "Avicii", "Le7els" (omitting .mp3)