Programming :: Double-quotes Do Not Escape Properly (bash=python)?

May 2, 2010

I wrote the Automatik widget (you can find it at :http://kde-look.org/content/show.php...&PHPSESSID=caeTo improve it, I would like to add this one-line script into a text sensor :

top -b -n 1 | head -12 | tail -6 | sed '/top/d' | awk '{ printf "%-12.12s %-4s %-4s %-3s
" , $12,$9,$10,$2}'

[code]...

View 3 Replies


ADVERTISEMENT

Programming :: Remove Double Quotes Bash?

Jul 20, 2011

grep -e XkbLayout /etc/X11/xorg.conf | grep -v "^#" | awk '{print $3}'

output = "gb"
sometimes= "us"

View 4 Replies View Related

Programming :: Double Quotes Inside Double Quotes?

Jun 6, 2010

In bash I need to use some equivalent of double quotes inside double quotes (or the other way around.)I need to run the following statement to get the output of foo and store it in a variable while passing foo the $file which probably contains spaces.

Code:
variable=$(foo "$file")
The problem is that foo might return an empty string and if it does I need to catch it

[code]...

View 6 Replies View Related

Programming :: Ignoring Commas Within Double Quotes?

Nov 4, 2010

I'm trying to write a bash script that has to extract values from a csv file. Problem is there are lines like this:a,b,c,"dd,dd,dd",e,f,gI'm using awk to extract the values but when I try it extract value 4 with awk I get:"ddinstead of:"dd,dd,dd"Does anyone know how to get awk to ignore commas within double quotes?

View 5 Replies View Related

Ubuntu :: Double Quotes And Single Quotes Not Working In 11.04?

Aug 2, 2011

I am not sure If anybody has faced this issue, my keyboard is less responsive when pressing the double quote/single quote key, I have to press it twice for it to print the quote( and that too it prints some other data and not exactly a double-quotes). Initially I thought it was issue with my keyboard, but later I see that it is working fine in Windows XP. It looks some kind of setting issue. If you check the below two examples, example a) is the double quote printed in Ubuntu, it doesnt exactly looks like a double-quotes and b) is the one printed in Windows.

View 1 Replies View Related

Programming :: Regular Expression Double Escape For Files That End With .la ?

Mar 18, 2010

I have been battling with regular expressions and am a little lost. I want to find all my files that end with .la and have been trying this

Code:
slocate -r .la$

which finds them but also files like mozilla. The escaped full stop seems to be ignored however this works :

Code:
slocate -r \.la$

so why is the double escaping needed ?

View 3 Replies View Related

Programming :: Python - String To Omit The Single Quotes (')?

Mar 18, 2011

After I assign a string to a variable, I know that the print function will remove the single quotes around the value, but is there a way to assign a variable without the quotes around the value? for example:

a = open('/usr/lib', 'r+')
b = f.read()
c = x.replace('.xx','yy')
d = ?

c returns the value with quotes around it print c returns the value without the quotes Is there a way to assign a new variable (d) which will equal c without the quotes? I need a new variable which has the quotes omitted because from there the script will take the value of the last variable (which is a path to a file), and tar up that file. It won't recognize the path to the file if the value has quotes around it.

View 1 Replies View Related

Software :: Escape Single Quotes In Sed For Multi Line Pattern?

Jul 18, 2011

I have some code written in VHDL that looks as follows:

Code:
foo = "bar";
foo <= 'bar',

[code]...

View 1 Replies View Related

Programming :: Escape '*' In Case Statement Bash

Jan 23, 2010

Does it possible to escape * in the case statement

Code:

View 2 Replies View Related

Programming :: Watch Not Interpreting Escape Codes In Bash Script

Jul 19, 2010

I need a script that can print some series of strings in colors based in the information of a file, for simplicity let's say it only does:

Code:
#!/bin/bash
printf "e[1;31;32m%-10se[00m" "OK"

When you execute this in the command line it prints a bold green 'OK'. So far so good.

Now, I need to check the output of the script over time using the command watch. The problem then arises. watch seems to ignore the escape codes and just prints:

Code:
[1;31;32mOK [00m

Is there any way to fix this?

If not, how can I check inside the script if it is being executed from a command? (watch in this case) So I can print without color for those cases.

View 4 Replies View Related

General :: How To Use Rsync When Filenames Contain Double Quotes

Jan 29, 2011

I am trying to synchronize the content of the directory my_dir/ from /home to /backup. This directory contains a file which name has a double quote in it, such as to"to. Here is my rsync command:
rsync -Cazh /home/my_dir/ /backup/my_dir/

And I get the following message:
rsync: mkstemp "/backup/my_dir/.to"to.d93PZr" failed: Invalid argument (22)
For info, rsync works well when the synchronized filenames contain single quote, parenthesis and space. Thus, why is it bugging with a double quote?

View 3 Replies View Related

Ubuntu :: Sed Finding Item That Contains Double Quotes?

Jul 28, 2011

trying to edit a huge configuration filer graphviz that containsIP addresses.unfortunately, some of the IP addresses didn't get parsed right and have only 3 octets. I am trying to use sed to find these 3 octet lines and delete the line entirely.example lines in the file look like this.

"22.210.73" -> "192.168.159";
"22.210.232" -> "22.210.248";

i have tried doing various things but to no avail. i had something that looked like this...

sed -i '/"*.*.*"/d' myfile

View 2 Replies View Related

Red Hat / Fedora :: Replacing SNOWMAN With Double Quotes Using Sed?

Feb 24, 2010

We have 'SNOWMAN' UTF-8 character in our files which i need to replace with doublequotes (").The UTF-8 hex value for 'SNOWMAN' is 0xE2 0x98 0x83 (e29883) , I have written the commands like this but it is not working .........sed -i 's/x0xE2 0x98 0x83/"/g' FileName

View 8 Replies View Related

General :: Escaping Double Quotes In A File?

Dec 12, 2010

I know it is pretty trivial but anyway...I have php file that I am trying to read it looks like this

...
add_item_tabulky("Klaun-PF 2011","klaun_pf2011.jpg","","","");
add_item_tabulky("Pras�tko-�ťastn�

[code]...

View 3 Replies View Related

Fedora :: Keyboard: Single And Double Quotes Not Working?

Jan 21, 2010

I have a problem with my keyboard. I�m unable to type single or double quotes, at least not the regular sort that you need to write code in almost any programming language ever invented -which makes it pretty useless.A demonstration.Single left and right tilted quotes:Double quotes: m not able to type a single straight quote at all.I just want my keyboard layout to be standard US like everyone elses so I can get on with my work so does anybody know how to just reset it to a normal layout?

View 4 Replies View Related

Ubuntu :: Shell Curly Braces With Double Quotes Does Not Expand As Expect?

Jan 13, 2011

I'm really new here this is the first try to get some knowledge here.I have a littele question."echo {1,2}" does expands 1 and 2.so does "echo "`echo {1,2}`"".But when I do it with double quotes which is "echo "{1,2}"" it doesn't expand at all.why does this happen? I have read man for bash but could not get any clue.

Yuki
Code: -- the output i see --
sh-3.2# echo {1,2}

[code]...

View 3 Replies View Related

Programming :: Piping In Bash Using Python?

Dec 16, 2010

I have a bash script that I want to import in to Python, mainly just to see if I can or not. However in the script I do use some piping of commands into sed to trim it down to what I need. When I tried doing it with the os.system() call, it didn't work. The exact error is

sed: -e expression #1, char 16: unterminated `s' command

However the command that was run can be run in bash without an error. Is there a better/another way to do this? For reference the command is:

Code:

locate -n 1 wp-config.php | sed 's/wp-config.php/
/g' | sed '/wp-config.php/ d' | sed '/^$/ d'

View 3 Replies View Related

Programming :: Python To Bash Translation?

Oct 17, 2010

Ive been learning bash over the past 6 months or so and have written a few scripts etc and i have just downloaded julius to execute my scripts and a few commands with speech recognition, the example script that comes with julius to execute commands is written in python and the example works fine when executed but i would like to further extend and customize it but i dont know anything about python, so ideally i would like to translate it to bash as that is what i am learning/using at the minute and would like to learn/use one language at a time, translating it as i think im a little out of my league, i look at the script and sort of understand how it works but i dont know anything about python and my knowledge of bash is limited for use of translating languages.

the python script is:

Code:
#! /usr/bin/python -u
# How to use it:
# julius -quiet -input mic -C julian.jconf 2>/dev/null | ./command.py
import sys

[Code].....

View 1 Replies View Related

Ubuntu :: Escape Sequence For New Line In Python?

Apr 14, 2010

I am reading "A Byte of Python" and this is the 2nd time I've completely been confused about something:"What if you wanted to specify a two-line string? One way is to use a triple-quoted string asshown previously or you can use an escape sequence for the newline character - toindicate the start of a new line. An example is This is the first lineThis is thesecond line. Another useful escape sequence to know is the tab - There are many moreescape sequences but I have mentioned only the most useful ones here."In python:>>> "This is the first lineThis is the second"'This is the first lineThis is the second'>>>

View 1 Replies View Related

Programming :: GTK / Glade Use C - Bash - Pascal Or Settle For Python?

Dec 17, 2010

I have searched the net for guides on GTK/Glade and have learned that I have to install Glade in order to experiment with it. It also appears that it only works for Perl. I would primarily like to use C ,Bash , Pascal or settle for Python if possible. Can anyone offer some general info on this topic?

View 4 Replies View Related

Programming :: Python Passing Multiple Args To Bash

Jan 14, 2011

I have a text string I want to pass as the second arg to a bash shell.

My python line is :

The first arg "gap" works great and the bash shell uses it as $1

I need "fill" passed along as $2 intact

Here is the bash line:

As you can see after the -f it has to be in single quotes and $FILL will complete the single quote

Nothing is getting passed as a second arg from python, I did have the first word at one time but that was 85 tries ago and forgot how I did it!

The bash script complains about an unterminated quote.

View 6 Replies View Related

Ubuntu :: Install A Version Of The GStreamer Python Bindings Greater Or Equal To 0.10.19" Without The Quotes?

Sep 29, 2010

When i try to run pitivi i get the following message and it closes down. "Install a version of the GStreamer Python bindings greater or equal to 0.10.19" without the quotes.What do I need to do? Where is the deb package for gstreamer needed?

View 9 Replies View Related

Programming :: After USB Boot - Detect Which Device The Ramfs Was Loaded From - Bash Or Python

Sep 22, 2010

How one could determine (for use in a Bash or Python script) which device (eg /dev/sda1, /dev/hda1... etc) a ramfs was loaded from when booting from a USB drive.

I have a RIPLinux/Tinycore live USB disk that automatically needs to run a script that is stored on the same USB drive but not part of the RIPLinux/Tinycore image. (Please note that I do not want to put this script into the RIPLinux image.) I therefore would like to remix the RIPLinux/Tinycore ISO to automatically run this script once it has started up. After RIP linux has booted I would like to automatically mount the USB drive that RIPLinux/Tinycore was booted from. I need help detecting which device this is.

View 3 Replies View Related

General :: Surround A Line With Quotes On Bash?

Apr 24, 2010

When I run for i in $(find -name '*.ogg'); do echo '$i'; done I don't get one line per file as I expected. Instead, when a file name has a space in it, each word comes out in a separate line, so I can't run commands on the files.

View 4 Replies View Related

Software :: Bash Arrays And Quotes (PvPGN)

Aug 23, 2010

I am trying to get PvPGN working... I have installed all the files, the only thing now is that bntrackd wants to use 'logs/bntrackd.log' for it's logfile, but seeing as it's in /usr/sbin, I want it to use /var/log/bntrackd. This is done with 'bntrackd --logfile=/var/log/bntrackd.log' but when I put that in the script it won't process it as a command (instead splitting it and complaining that I don't have --logfile=/var/log/bntrackd.log installed)

/etc/rc.d/pvpgn:

Code:
#!/bin/bash
...
[ -z "$PVPGN_DAEMONS" ] && PVPGN_DAEMONS=(bnetd d2dbs d2cs)
...
for d in ${PVPGN_DAEMONS[@]}; do

[Code]....

View 4 Replies View Related

Programming :: Calling Bash Script With More Than One Variable From Python Script?

Oct 4, 2010

I am calling a bash shell script from a python script trying to pass several arguments to the bash script with no succes can this be done? I have researched (google) with no clear indication of how to achieve this. Using "os.system"

View 4 Replies View Related

Programming :: Bash-shell-like Less Functionality In The Python Shell?

Jun 25, 2010

Is there some type of functional way to read things in the Python shell interpreter similar to less or more in the bash (and other) command line shells?

Example:

Code:

>>> import subprocess
>>> help(subprocess)
...
[pages of stuff to read]
...

I'm hoping so as I hate scrolling and love how less works with simple keystrokes for page-up/page-down/searching etc.

View 4 Replies View Related

Programming :: C++: Macro Not Defined In Quotes?

Dec 12, 2009

I converted my programming project over to autotools, which gives me a config.h file with all the cool definitions, like these ones:

Code:

/* Location of data files. */
#define DATADIR "/usr/local/share"
/* Define to the full name of this package. */
#define PACKAGE_NAME "lusus"

And naturally I think this is cool because then I can hardcore these into the binary. To my dismay, however, I discovered that the pre-processor does not do the text-substitution if the macro name is inside another quoted string.

Code:

// Prints out "/usr/local/share/lusus"
std::cout << DATADIR << "/" << PACKAGE_NAME << "
";

[code]....

This seems lame, because then this doesn't work:

Code:

CL_Image leaves_corner_tl(gc, "DATADIR/PACKAGE_NAME/img/leaves_corner_tl.png");

So, am I literally going to have to strcat DATADIR/PACKAGE with the other text every time I want to prefix DATADIR/PACKAGE_NAME onto another string?

View 2 Replies View Related

Programming :: Make Python Programs Run Without Entering The Command Python?

Mar 22, 2009

I want to be able to do

sudo ./program.py

instead of always having to do

sudo python program.py

What do I need to change?

View 5 Replies View Related

Programming :: Python - Get Text File Data Into An Array On Python?

Nov 30, 2009

I've already used line split stuff to transform my data into something like this in a text file:

Code:

['1', '1', '3', '20.7505207']
['2', '1', '3', '23.0488319']
['3', '1', '3', '-1.5768747']
['4', '1', '3', '-26.4772491']

[code]....

How can I get this on a python program so I can manipulate it as an array?

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved