Linux Sucks….

O.k. so it’s kind of late and I just want to rename a bunch of files using the freaking powerful command line we love so well.

The only way to actually do this appears to be to i) learn regular expressions try man rename if you don’t believe me or ii) get a for loop going inside the bash shell and then get it to do some sort of substitution.  Jeeezzzz

Back in the old MS-DOS days rename trv22.* P0_097.* just used to bloody work, it is times like this I wish I had bought an Apple Mac….

(Now I know that you can do this a number of ways and there are lots of examples on the web but they generally require you to debug some sort of script)

Advertisements

3 thoughts on “Linux Sucks….

  1. Richard Chapman

    Something doesn’t suck just because you don’t know how to do a particular task with it. But your little blog here showed up on my Google Blog search for “Linux”. These “Linux Sucks” titles show up every day. It’s become sport for me to answer them. But yours is a little different. It’s not a long list of tired broken myths. You just couldn’t do something. Has that ever happened to you in Windows? It did with me. As a matter of fact, every time Microsoft came out with a new operating system I’d have to learn a bunch of new things. I got tired of it. I’ve been using Linux now for over three years and it has yet to come out and hit me with a whole new way of doing things. It just changes in small increments very often.

    I don’t know what desktop you are using, but if it’s KDE just type “man:rename” in the address bar in Konqueror and you’ll get an HTML version of the man pages with clickable links and all. It’s way easier than accessing the man pages via the command line. There is also “info:rename” but only if you have the right packages loaded. It gives more information than man does.

    The main complaint I hear is that Linux is not as easy as Windows. That’s another way of saying that it’s different which is the same as saying, it’s not like Windows. If Linux was exactly like Windows why switch? What is it about Linux or Windows that makes people even want to try Linux? I think I found the answer in a blog I read recently: “On a side note, I’ll point out one difference between the two groups. People on the Linux side love Linux and hate Windows. People on the Windows side just hate Linux, they don’t seem to show a great love for Windows other than [it does what I want it to do].

    Reply
  2. grantingram Post author

    Wow! Someone actually reads this blog other than me 🙂

    Thanks for your carefully thought out comment! Actually I did mange to rename my files: rename s/trv22/P0_097/ trv22.* does the trick using a Debian based system. The sucking comes from having to read a number of web-pages and accidentally overwrite all the data whilst trying to get a for loop to work in Bash in order to accomplish something that you didn’t have to read any manuals for in 1985.

    This Blog isn’t called “Software Configuration Tips from an Idiot” for nothing!

    I don’t particularly love or loathe my operating system, I use GNU/Linux/GNOME/Firefox etc because free software puts you in control of your computing and not the other way around.

    Thanks very much for you comment once again.

    Reply
  3. Andrew Kemp

    Hi Grant,

    The MS DOS example only works because MS DOS sucks: the command shell provides no wildcard expansion of filenames, and the individual command-line programs all have to implement this themselves. In particular, this means that “rename” is free to interpret ‘*’ differently for its two arguments.

    If you had bought an Apple Mac, you would have found that there is no “rename” installed by default (man rename gives the documentation of the system call). So you would probably be back to the loop in bash.

    for f in trv22.*; do mv $f $(echo $f | sed s/trv22/P0_097/); done

    To test this sort of thing without fear of overwriting files, put “echo” between the “do” and “mv” so that it just prints out what it would otherwise have done.

    Mac OS X does have a pointy-clicky way of doing this using Automator, which is fairly entertaining (but still quite fiddly):

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s