Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Diff Grep File extensions and illegal characters

    Hi there

    I'm copying my music from my PC to my laptop, currently my PC uses .flac files, however my laptop HDD is too small for this so I am converting to MP3s.

    I have done this previously with my mp3 player with small files and I'm going to make decent MP3s for the laptop (-Q2 or VBR=192kbps kind of quality)

    The laptop runs windows 7 and I don't want to change it (its for uni, need to use photoshop, IE and word everyday, so I probably won't even dual boot this) but the PC runs Linux.

    To check the files have all copied correctly from one mp3 size to another in the past I had used diff and grep commands. However, if I do this with flac and mp3 it simply lists every file because they are all "different" can I tell diff or grep to look at the file names only and ignore the extensions?

    Also, is there a way for grep to find all the files with non-windows friendly file names so I can quickly edit by hand? (tried batch convertors but too complex for my needs)

  2. #2
    Linux Guru Cabhan's Avatar
    Join Date
    Jan 2005
    Seattle, WA, USA
    You can use the "basename" command to get the part of a filename without its extension:
    [alex@niamh ~]$ basename myfile.mp3 .mp3
    You should be able to whip up a script of original files minus extensions and new files minus extensions, and make sure they're the same. If the extensions are always the same (e.g. .flac for original, .mp3 for new), this is pretty easy. If they're different, you may need to dive into sed.

Posting Permissions

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