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
$ 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 want the value between default tags 111 in this case.
I treid to use ${var1:10:3}
But the execution gived "bad substitution' error. If the tags are removed and substring is fetched it works fine. Is there any other was to get substring in a string with tags.
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"
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.
There is always one occurrence of € in each line. I want the numeric value that precedes this € occurrence. The random text (before and after) may contain numbers too, so the € may be important to parse, in order to correctly identify the number to return. The last character that precedes the number to extract is always a ">" (coming from an HTML tag).
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
I would like to remove a part from wiz_khalifa-black_&_yellow-(82_bpm).mp3 The part to be removed is -(*_bpm)
so that makes wiz_khalifa-black_&_yellow.mp3
Also a problem is that sometimes multiple "(" occur in a filename (wiz_khalifa-black_&_yellow-(remix)-(82_bpm)), so how can i only remove from the last "("
I have just re transcoded a bunch of avi's. to tell the new ones from the old ones I put '[xvid]' at the end of all the new avi's. but now I have deleated the old avi's I want to remove the [xvid] part of the file name. This is what I have so far
Code: #!/bin/bash for name in *.avi do newname=`echo "$name" | tr -d [xvid]`
This may be a basic bash array/string operation related question, but I couldn't find any direct answer. So here it goes:I have a lot of data sorted in various directories. All directories need same processing except for a special group of directories. I have a symbolic link of the script in discussion in each directory. I want the script to get the name of the current directory, check if that belongs to special group and do specific operations.So I get the name of the directory
Code: mm=`basename `pwd`` Now the the group of directories that needs something different to be done, contains these
I have a directory that has a large number of files, around 1.5 million at this point. If I go to the directory and type in "ls filename" for a filename that I know exists, ls just hangs. I have let it run for over 20 minutes and it never does anything. Up until yesterday the directory was working fine through samba serving up files, but now it doesn't return anything. How to proceed from here?
I run 5GBFree.com a free hosting site. As you can imagine, it gets quite a few people signing up to abuse the service.Recently I've found a LOT of people setting up sites with a particular script that floods forums and IRC chat rooms. The names of the files are as follows:
Is there a command I can run to remove files with these filenames ANYWHERE on the server (so basically, a command to go through all folders on the server and remove instances of that name
I am trying to strip the .wav file extension from a file name so that I can pass the result to lame encoder. I started to write a BASH script that looks like this:
Code:
for f in /home/user/wavfiles*; do FILE=basename $f .wav; lame $FILE; done
It doesn't work very well though. For the life of me I can't seem to discover how to use basename in a suitable way for a script like this.
I wish to know what could be the possible cases for this error:cp: reading `filename': Input/output errorI am getting this message when I am trying to copy a big file of around 50MB.
I have a very large directory with probably millions of small files in it. It's taking forever to run ls on the directory.
Is there an easy script that I can run to split the directory into smaller ones, based on the prefixes of the filenames. My goal is to wind up with something similar to what the Debian archives' pool directory looks like.
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 have local Wordpress database that got corrupt as a result of an abrupt power outage (I wasn't even editing it!).
Since the system I am dealing with is pretty static (and old), I just want to restore that database file (or collection of files) from a nightly backup.
But I don't know which files I should be restoring. The WordPress blog in question is installed under a local user account in an old Linux server (FC4).
I checked the wp-content directory, but apparently this is not where the content is:
Any idea which file(s) I should be restoring and what their path is?
I'm working with a lot of data, but always the same. I have, say 2GB that I keep loading 100 times a day from a local disk to do some computations.I was wondering if anyone knew if it is possible to read it once for all and then access it like a file but with the speed of RAM access. I would be looking for something like: Code: file2mem ~/mybigdatafile.dat ~/mybigdata_thats_now_accessed_superfast.dat And then the data is accessible in a way like with a symlink...
I am using the following command: zgrep -a --text "TEST" * | awk -F"[ .,]" '{sub(".*:","",$6); sub(",.*","",$7); print $1,$6,$7,$10} and getting N3 2009-11-25 20:12:57 TEST N4 2009-11-28 10:42:18 TEST N6 2009-12-01 10:00:24 TEST
If I only want to search the log file after 2009-11-29, what shall I change the command?