Programming :: Bad Substitution Error - Stripping Unnecessary Word From Song Title
Dec 22, 2010
I can find points to Tillies Garrels TLDP reference. Do I want to create my own variable to hold the string or do I want to place the string in memory? Is that my problem? Or is something different causing the 'bad substitution' error.
[code]...
View 14 Replies
ADVERTISEMENT
Jan 23, 2011
I have a customer that was raving how he likes windows 7. I asked him what he saw improved over xp, and he could only list the mouse hover preview of tasks in taskbar and media player could show all songs with word black in title. I am training my 3 and 5 year old on Ubuntu, and they (& wife) cannot grasp the difference between bottom taskbar and top applications menu. Even on my xp machine they freak out (including 10 year old with computer classes) when I minimize their applications to work on my own when they get up from the dining room machine.
And, so I though I would download "Visual tray tip" which mimics the taskbar preview on mouse hover. But on my 6 gig hard drive, p3 650 mhz 1 gig ram living room notebook (mainly flash educational gaming for kids) I really would like such a task bar preview. But upgrading Ubuntu is out of the question, since it is a functioning machine with 211 megs free on drive, and I have no stomach, time, or wish to kill it by an upgrade. So, am wishing for a sudo apt-get install solution.
View 8 Replies
View Related
Aug 15, 2010
I'm trying to make a webpage that will display the bash variables I have in a file. These variables are used in a bash script that is run from on my server.The file looks like this:
SERVER=canfs01
SHARE=public
USERNAME=guest
[code]....
View 7 Replies
View Related
Mar 4, 2010
Well, I am facing one issue:How can i read two files word by word at a time using any loop as i need word by word comparision in shell script?Please let me know pseudo code.
View 14 Replies
View Related
Jan 21, 2011
I have a output file look like this:
{"test1" : "test2", "test3" : "test4"},
How can I read word by word in each line?This is not working code:
a=0
while read word
do a=$(($a+1));
[code]...
View 14 Replies
View Related
Jul 16, 2010
I'm trying to use ${VAR:0:4} substring extraction described here: tldp.org/LDP/abs/html/string-manipulation.html and it works perfectly if i issue a command in bash. But when i put it in a script file and run it, bash gives me "bad substitution" error. Does anyone know how to fix it?
View 5 Replies
View Related
May 4, 2010
I am pretty new to bash scripting...I am trying to write a script that will take an input and read it word for word and then DO something with it like echo. I have been able to find how to read word for word from a file but I don't know how to do it with input.
I was looking for something like
Code:
exit 0 The input would be A-Z a-z 0-9 and have a single space between each word.
View 2 Replies
View Related
Feb 17, 2011
Just a simple BASH for loop to read the file path from a text file (clean.txt) echo the variable for debug purposes, and scp it to a server I have using port 50 for SSH.
I've already formatted the entries in clean.txt to handle spaces correctly, using sed replacement.
Example from the clean.txt file:
Code:
/MP3/NAS000000001/Barenaked Ladies/Barenaked Ladies - Barenaked For The Holidays/20 Auld Lang Syne.mp3
/MP3/NAS000000001/Barenaked Ladies/Barenaked Ladies - Barenaked For The Holidays/14 Deck the Stills.mp3
[Code]....
View 5 Replies
View Related
Jul 1, 2010
I have the following test code fragment:
Code:
When I try to run it 'sh' reports the following message^
Code:
You might understand what I mean with that test code so could you recommend how to achieve the required effect?
View 7 Replies
View Related
Nov 25, 2010
file allids consists of 300,000 rows, each containing a 5-7 digit numeric id. file newids consists of 20,000 rows of id's. How do you explain the following timings? time: 0.07s:
Code:
diff <(sort allids) <(sort newids)
time: 1.6s:
[code].....
View 4 Replies
View Related
Feb 3, 2011
I'm working on a program that will allow non-privileged users the ability to substitute passwords that are read in from a 600-root:root file.
A user might call it like this:
/bin/securepasswrapper "/path/to/check_ping -u Admin -p ?webserver1?"
The file (defined now as /tmp/securefile) will be searched for the identifier "webserver1", and it's corresponding password will be returned to securepasswrapper. Now, I know you could just call /bin/echo, and get the output, but that's in scope at this point.
File format of securefile is:
<identifierassword>
ex: webserver1:asdf123
Once the password is properly substituted in, securepasswrapper should then execute it as the UID/EUID of the calling user (not root)...that part I've not got to yet.
Code:
/* program: securepasswrapper
author: R.Briggs + Google
date: 02/02/11
purpose: C wrapper that replaces placeholders in a string with secure passwords retrieved from a file
*/ .....
View 5 Replies
View Related
May 6, 2011
I have an interpteter that supports string literals, and the way it works is that the lexer returns the entire string as a single token, with the quotes removed and escape sequences replaced with the literal characters they represent.
I already implemented single-quote strings, they don't interpret any characters specially except for the single quote. I partially implemented double-quoted strings, they already support all the same backslash escape sequences that C does. But I would also want to add variable substitution.
The way it would work is that "${expression}" would interpret the expression (which could just be a variable name) and replace itself with the result. But I have no idea how to do this.
In case it matters, I'm using a hand-written lexer and recursive-descent parser.
View 14 Replies
View Related
Jun 19, 2009
I made a little rsync script for log transfer.
Code:
SERVERS=(SERVER1 SERVER2 SERVER3)
SERVER1_SERV=(web ftp mail)
SERVER2_SERV=(web transcoding)
SERVER3_SERV=(web ftp mail)
for SERVER in ${SERVERS[@]}
do
echo "Starting tranfer for server $SERVER"
for SERVICE in ${$SERVER_$SERVICE[@]}
do
something_to_be_done
fi
done
But when I run it I get ${$SERVER_$SERVICE[@]}: bad substitution
View 5 Replies
View Related
Dec 21, 2008
I have a simple script that I am writing to parse an XML file for me, and update some version numbers. Basically what happens in my script is that I'm running a grep command on the file to get the current version number, then I prompt for a new number, and then I want to globally replace that version number in the file. The problem is, the sed command seems to only want literal values (it doesn't appear to be capable of resolving variables). For example, this code doesn't work:
[Code]...
I have tried removing the curly brackets from the variable names, quoting them, etc. and nothing seems to work. Should I do this with awk instead (and if so can you kindly write out the command for me because I never bothered to learn awk).
View 2 Replies
View Related
Apr 30, 2011
I remember reading that using sed, you can do this with parentheses: s/abc(something)def/(something)else/g I can't find an explanation of how to do something like this with Awk. Say you have this in an HTML file, where (number) stands for a one or two-digit number:
<sup>(number)</sup>
And you want to change that to this:
<a name="(number)t" href="#(number)b"><sup>(number)</sup></a>
How would this be possible? Would you have to use sed?
View 4 Replies
View Related
Jun 6, 2011
I need a substitution of a particular string (StringA) with another string (StringB). However, there may be more than one occurrence of StringA within the file, but only one instance needs to be changed, which is why I'm trying to be sure of it's positioning against something I know will be unique in the file, and will always have the same distance from the string to be replaced. So, I intend to match on a string (StringC) above the string to be substituted and then have sed go to StringA below and replace with StringB.
So far, I have had some success with the following:
Code:
... but I can't help thinking that there *has* to be a cleaner way of doing it.
View 6 Replies
View Related
Jun 15, 2010
I have the following TCL code:
if{ [catch {sqlite3 db /path/to/db/file} result] } {
puts stderr $result
} else {
do something
}
What I want is to use a variable for the file name/path. When I put in a variable instead of the absolute path, I get an error: "missing close-brace: possible unbalanced brace in comment while executing"
This is weird because when I run the code with the fully qualified pathname, it works fine. I substitute out the pathname for a variable containing the pathname ($variable) and I get this error.
View 1 Replies
View Related
May 24, 2010
After apt-get upgrade I get this:
Setting up linux-image-2.6.32-5-amd64 (2.6.32-13).
Running depmod.
Running update-initramfs.
update-initramfs: Generating /boot/initrd.img-2.6.32-5-amd64
Running update-grub.
/etc/default/grub: 26: Syntax error: EOF in backquote substitution
[Code]...
View 7 Replies
View Related
Sep 24, 2010
I'm looking for some pointers on a method to "transfer" the song-playing from my laptop to my PC, both running ubuntu. The use case is: I'm home listening to some song on the laptop. Then I realize how crappy the speakers are. Here's what I do *now*:
1. Stop playback on the laptop
2. Get up, go to the PC, open the music player
3. Find the same song
4. Try to find the same point in the song
5. Stop playback on the laptop
6. Start playback on the PC (the PC has good speakers)
Of course now I'm dreaming of having a "button" I push that does all this all by itself. Can anyone give me some pointers?
View 6 Replies
View Related
Mar 14, 2010
Further to solved LQ thread Bash: how to populate a list of arbitrarily named files?, what is the functional difference between feeding a loop with process substitution and feeding it with a here string with embedded command substitution? ABSG pages: process substitution, here string and command substitution. This works
Code:
while IFS= read -r -d '' file
do
files+=("$file")
done < <(find $dir -type f -print0)
[code]....
View 2 Replies
View Related
Aug 31, 2010
I am repeatedly getting error:
I need to pass the value of:
I am using #!/bin/bash
This command works on shell without any issue.
View 8 Replies
View Related
Aug 21, 2010
So when I upgraded to Slack64 13.1 on my asus MB homebrewed desktop and Slack 13.1 on my compaq presario a900 laptop, I started having issues with the xterm title (in Terminal--not Konsole) being too dynamic. By "too dynamic" I mean that I can't actually change the title. The dynamic title (from my .bashrc) is basically just pwd. Whenever I try to set the title (via terminal->set title (menu)), I changes it for a split second, and then reverts back to the dynamic title.
This is merely a petty annoyance, so to get around it, I added an xtitle function that I grabed somewhere online (just echos "�33]0;$*�07"). So for nano-ing some file, I'd type:xtitle some_file.txt; nano some_file.txt
That works just fine (kind of annoying to type though). running xtitle alone won't actually change the name either though (I'm pretty sure it's the same command as what terminal does anyway). That is, running: xtitle some_file.txt
changes the title for a split second, and the reverts back to my old pwd.What I really want is to have it dynamically name it "some_file.txt" whenever I use nano, but that appears to be a functionality of zsh (with the preexec() fxn).I'm wondering if anyone else has had this problem, and if you have a fix for it.
View 3 Replies
View Related
May 2, 2010
after upgrading from Karmic Koala 9.10 to Lucid Lynx 10.04, i notice something different with title bar on every window opened.
for example:
"Google - Mozilla Firefox" is not at the middle of the window title. and on Lynx it's on the left.
View 6 Replies
View Related
Apr 4, 2010
I am trying to get the title of all the windows that i open,but cant make it right... code...
the problem is,that it will write the current windows many times,until i open another window,and so on.
View 1 Replies
View Related
Feb 27, 2010
As far as i know VLC is the best media player for linux bc it suppurts all file types. But there is one anoying problem - when i want to listen to song it opens VLC, but when i open another song it opens another new VLC window. And this problemug or whatever didnt apear in Windows version VLC player.
View 4 Replies
View Related
Mar 30, 2010
i got a dual-boot. both are debian. yesterday i upgraded one of them to debian-squeeze and to grub2.that installations boots just fine.but for the second i get the error message from the thread title:"render error detected"after the grub-menu.if i choose single user mode it boots and hangs waiting for the root file system.i found this results at google (which i am not allowed to post yet) but i don't understand them.
View 8 Replies
View Related
Jun 28, 2011
Want to search for ~ and delete it as well as to append the entire line to the above line. For Ex:
1111xxxx date Sandy area is ~around this area.3222xxx date There seems to ~left side of map, the colours are accurate (showing green areas)Even if I ~zoom in, the green parks, xxx3258 date The dammed up
~away, the "other" body of water varies ~blackNatural gas leaching.
IT MUST LOOK LIKE:
1111xxxx date Sandy area is around this area. 3222xxx date There seems to left side of map, the colours are accurate (showing green areas)Even if I zoom in, the green parks, xxx3258 date The dammed up away, the "other" body of water varies blackNatural gas leaching.
View 4 Replies
View Related
Mar 25, 2011
i jst want to delete a host entry from httpd.conf the entry for lal.com should be deleted!!
View 14 Replies
View Related
Nov 9, 2010
I have these but not working.
size_t count_words(const std::string& s)
{
std::istringstream is(s);
return distance( std::istream_iterator<std::string>(is),
std::istream_iterator<std::string>());
}
and
std::string s; // word count
unsigned int wordno = 0;
while(getline(myfile, s))
{ ++wordno;
if(s.empty())++ wordno;
else wordno += count_words(s);
std::cout << s << '
';
}
myoutput1<< "Number of words : " << wordno << '
';
myoutput1 << "
Word" <<" " <<" Occurrence" <<endl;
myoutput2<< "Number of words : " << wordno << '
';
myoutput2 << "
Word" <<" " <<" Occurrence" <<endl;
View 6 Replies
View Related
Feb 19, 2010
I have to modify formsweb.cfg file in Oracle IAS.
Problem description
In formsweb.cfg file are two lines with labels archive_jini= and archive= at the beginning of line. After equal sign (=) is row of filenames of java archives delimited by coma(,). When I insert a new jar file in java directory, I have to append the very same name of jar file to both lines if that name is not yet present.
Example snippet from formsweb.cfg
View 2 Replies
View Related