General :: Explanation Of Command To Uppercase First Letter Of Filename
Jun 10, 2010
I'm trying to learn to rename files with the command line, and after browsing around a lot of pages I finally found a command that uppercases the first letter of a file, but the problem is that I want to understand the meaning of each command. The command is:
for i in *; do new=`echo "$i" | sed -e 's/^./U&/'`; mv "$i" "$new";done
I understand the 'for' kinda... but not the 'echo' or '`' and especially the sed command.
I am currently in the very early stages of learning how to use the shell and write scripts (and I mean really early- only been at it for 3 days or so). Now I am following a tutorial, and I have reached a section about the so-called "here scripts" or "here documents".
[Code]...
Now what I don't understand is how those two scripts, once run, produce the same output.. I believe this is because I don't understand the "cat"-command (which is not quite useful, considering it seems to be a very practical and widely used command).
So would anyone care to explain to me what it does in this specific script as well as alternative applications? (And please refrain from just quoting the man-pages.. I have read them multiple times, and I still just don't get it - It's probably very simple,
$ uname -a Linux a 2.6.35.10-74.fc14.i686.PAE #1 SMP Thu Dec 23 16:10:47 UTC 2010 i686 i686 i386 GNU/Linux $ lsb_release -a LSB Version: :core-4.0-ia32:core-4.0-noarch
[Code].....
How can I set a pattern that will output a filename equal to the original filename? E.g.
I am trying to do a find/grep/wc command to find matching files, print the filename and then the word count of a specific pattern per file. Here is my best (non-working) attempt so far:
Back when I was first learning Linux, one of the questions that I kept wondering about was "what are all these files and directories for?" I couldn't find a resource that would explain them in a digestible manner. Specifically, I was looking for one that would allow me to look at a Linux filesystem interactively, collapsing and expanding folders to look at just the ones I was interested in at the moment. So later, when I got the opportunity, I wrote it.
But despite a ton of research, I'm still not totally knowledgeable on the subject. The most important thing I'm looking for right now is for experienced Linux/Unix people to tell me where I got stuff wrong, and for newbies to tell me how useful it is to them and which things need clarification. I'm also interested in technical and graphical ways to improve usability, like better icons, layout, etc. I know I need to be able to collapse long descriptions, but what would you like to see? The Works Cited list and a full introduction are still on the way as of this writing.
Without further ado: Linux Filesystem Hierarchy Explanation. You'll need a fairly recent browser that can handle XSLT; the actual info is stored as XML, and transformed into HTML with an XSLT stylesheet. This is still a work in progress, and I'll be updating it as the thread progresses.
Finally, would people be interested in collaborating with me on this, as an open-source project? I've never done anything like that, and I'm not sure how much time I'll be able to give it in the future, but I really think this should be continued and expanded.
Edit: Works Cited and decent intro are now in place.
I just installed Picasa from google and it has corrupted my picture database. The good thing is that it has done it in an organized manner. It appended -1 -2 -3 and so on to the copies file name. They look like (filename.jpg filename-1.jpg filename-2.jpg) the original having no numerical suffix just (filename.jpg)How do i write a command line to remove all of the undesirables without deleting the origionals?
As a result of having mixed files from different filesystems, I have, in directory foo/, files with filenames in uppercase and files with filenames in lowercase. If I want to convert them to all uppercase how do I do it? Consider this will be later recorded into optical discs.
We have an application that on a SCO box that we are converting to Linux.Basically it mount a CDROM drive and pulls data files off of it. We can mount the drive and it displays all the file/directory names in uppercase. Is there a way to do it in Linux?
I've installed ethernet adapter, it is made in china from a manufacturer called FOX. The driver for that adapter is supported for sco linux kernel version 2.4.x and 2.5.x .However, I'm using Centos5 but the OS didn't recognize the adapter alone, so I'm trying to follo instructions on the driver on the attached CD.
The CD contains file named "SC92031.c", the instructions tell me to do the following "Compile the driver source files and it will generate sc92031.o"
I'm trying to convert all file extensions for files in many sub-directories from uppercase to lowercase. I have two problems, how to list the absolute path to the files recursively over many sub-directories for which I so far have this:-
Code: find ~/Photos -print which would be fine, except it gives the directories on their own when it finds them rather than just the files with absolute paths. I couldn't find a switch for the "ls" command to do this, so I had to improvise with "find". and once I get grab each absolute file name, to just change the file extension rather than the entire file, which is what I have at the moment.
How can we convert a dynamic library (filename.so) to a static library (filename.a) using gnu gcc . Can we get a static library form a dynamic library . I saw a few post in which the conversion form a static library to a dynamic library is mentioned but, unfortunately, not the other way.
Want to format document from size A4 to letter.I need to format some documents from A4 to print on letter size paper. The documents are Word documents and pdf.
I have a RH5 box and develop on Windows. I'm looking to mount the root dir of the RH machine just for ease of integration and automatic deployment to the linux box. I'm using WinSCP at the moment but that (from what I can find) only opens a window, which isnt accessible from eclipse.
I'm trying to find a software which could map sftp/scp services to a windows drive letter. I know there are quite a bunch of those available, but i haven't found a single one which could run with SYSTEM or Netservice privileges or have decent command line options so i could elevate the program myself. The mapped drive should be available for other services running on the same server.
Most of the programs (sftp netdrive, expandrive, etc) have only option to startautomatically only when someone logs in. Because of that they are useless to me.Their inability to handle non-interactive starts is a bummer too. FTP->SFTP wrappers don't count as solution despite of integrated windows support for ftp drives. The way they are handled in windows makes ftp mapping unusable without some external ftp drive mapper software.
this seems to be a strange question, i know. I've a database sqlite file called "a.db".I need to copy it 20 times (1 time for each letter of the alphabet) to have : b.db, c.db , d.db.
Everyone who deals with Linux knows that partitions on hard drives are designated as "sdx#", i.e., sda1 sdb2, etc. I know through experimentation that the number portion of the designation is assigned not according to order on the disk, but chronologically in the order they are created.
Further, if you have several partitions on the disk-say, sda1 through sda3-and you delete sda2, the designation of sda1 will remain the same, but sda3 will become the new sda2. The creation of any further partitions on the drive will start with designation sda3 and increment from that point.
At times this creates a conundrum, especially concerning bootable partitions. Some time back I rendered a partition containing OpenSUSE unbootable because of this, even though Ubuntu owned the GRUB bootloader in the MBR. Ubuntu's GRUB could find and point to the partition using the command "sudo update-grub", but when OpenSUSE took over the boot-up process, its GRUB was pointed to the wrong partition and would freeze up.
My question is this:
Under Windows, one is able to make a Drive letter persistent. Windows will keep the drive letter for that partition and assign around it. Is there a way to change a drive designation number, or at least make it persistent, under Linux? It would be a handy method to forestall these types of booting problems, among other things.
Presently, when a person has installed Linux side-by-side with Windows and want to delete the Windows partition and expand the Linux partition into the free space, I will tell them to format the partition, then shrink it to next to nothing instead of deleting it. This preserves the partition ID scheme while giving them the space to expand their Linux partition into...especially helpful with a seasoned Linux installation that would be a PITA to reinstall and set back up.
Oh, and I already know about UUID. This article explains it, but if you look down through the comments, you will see reasons that it is problematic for desktop application and usage. I want to make it as simple as possible for new Linux users (and myself! ).
My family have three Linux operated ACER ONE netbooks, all of them need the new Firefox 3.6 download as the old format wont be supported supposedly by ..... etc. I have downloaded the SOFTWARE but cant get it to run, the Firefox explanation mentions lots of files etc that are cant access, nor can I excecute any files once they have been extracted. The same happens with any software but Iv ignored it till now, not having a "modern" browser will make things difficult. I need it explaining simply. On another subject can anyone use facebook chat on Linux
actually i want to extract the substring between 2 underscores e.g. in case of 1_40_37573.dbf i need 40 and in case of 1_101_37373.dbf i need 101 and so on
I have some school work that involves creating a script that creates a backup of my /home folder, everything goes well but the problem is with the filename.
I am supposed to create a .tgz with the filename : hostname-day-date-HH:MM:ss.tgz
The .tgz gets created with the correct filename but when I try to unpack it the filename can't be resolved, it's the : that mess things up.
in directory a_dir, have a file named a_file.i can type "source a_file" under directory a_dir and execute successfully.but if i write the command to a Makefile under directory b_dir, the "source" function can't be executed well. it will generate some error message like this:
./a_file: line 1: setenv: command not found ./a_file: line 2: setenv: command not found ./a_file: line 3: setenv: command not found ./a_file: line 5: setenv: command not found