Programming :: Escaping A Single Quote From A Bash Script?

Jul 21, 2010

There is probably a very simple fix, but its wrecking my buzzI call the following on the command lineR CMD BATCH '--args Y_filename="one.txt" out="two.txt"' brew.RI want to call this from a bash script but replace one.txt with $1, and two.txt with $2 (ie the first two arguments from the command line)I have tried in vane"R CMD BATCH '--args Y_filename="$1" out="$2"' brew.R"

View 8 Replies


ADVERTISEMENT

Programming :: SED - Convert Double Quote To Single

Jan 21, 2010

I want to convert double quote to single quote in a text file. I tried escape characters however no success. Please find details as follows:

-sh-3.00$ sed 's/"/'/g test.txt
sed: -e expression #1, char 7: unterminated `s' command
-sh-3.00$ cat test.txt
"unix"

I want "unix" to be converted to 'unix'

View 7 Replies View Related

Programming :: Script To Remove Single Quote That Begin And End File Names?

Aug 13, 2010

Made the following bash script named trimsquote:

Code:
#!/bin/bash
IFS=$'

[code]...

View 6 Replies View Related

General :: Basic Bash Filename Escaping ?

Nov 18, 2010

What I have done wrong with my escaping here:

Code:

The original filename is:

Code:

View 4 Replies View Related

Fedora :: Inserting To Escape Single Quote For Mysql Insert?

Oct 2, 2010

the project I'm working on requires parsing a text file with fields separated by the | char and using perl to insert/update a mysql database. Some of the fields are simple numeric and others are text fields. In some of the text fields I run into a problem creating a proper insert statement for the perl api to mysql if I don't escape the single quote (') char with a backslash (). I can take each text file and do a manual subsitutiton, but I would prefer to use the script that prepares the text file to do it for me. I've tried sed (ex: sed s/'/\'/g ) and it runs cleanly, but does nothing to accomplish my goal. I suppose I could write a function to read the file character by character and write it out that way, but it seems a waste.

View 2 Replies View Related

General :: 'watch' A Command Including Both Of Single And Double Quote?

Aug 12, 2010

I want to watch a number of processes in "D" status repeatedly with following command:Code:# watch -n 1 'top -b -n 1 | awk '{if ($8 == "D") {print; count++} } END {print count}''but it didn't work. I also tried with double quote. Can I use 'watch' command is this case?PS: I know 'while' and 'sleep' can do the same but it is dirty workaround.

View 2 Replies View Related

Ubuntu :: Sed - Searching Single And Double Quote Chars In Text String

Oct 27, 2010

I need sed to be able to search a string that includes both single quotes (') and double quotes ("). can anyone help me out, there has to be a way to do this.

So far I have tried:

But none of these work and I cannot think of how else to escape the sed quote inside of brackets.

View 3 Replies View Related

Programming :: Single Instance Of Bash Script?

Sep 12, 2010

I have a bash script which is called automaticallyI want it so that if when the script is called if a previous instance of it is already running then to delay the running of it until the previous instance has stopped (effectively queue up ./script.sh var1 var2)I have seen some posts about a 'lockfile' but this just seems to stop the second instance running rather than queueing it up to run next (it also needs to be able to queue up a 3rd/4th calling of the script and run them one at a time)

View 14 Replies View Related

General :: Bash - Get ' Quote ` Back-tic Through The Shell Into Sed?

Aug 3, 2011

In linux how do I to get the ascii decimal/hex/oct code from a char or a ascii char from a decimal/hex/oct code. I see from the gnu sed user manual that I can use the d# o# x# to specify a character but I am not sure how to use that. If some one has a better way to get the the ` and ' chars through I want to sed with the backtick '`' character and ''' single quote character.

sed '/`/p'

these don't work

sed '/'/p'
sed '/`/p'

View 3 Replies View Related

Programming :: Escaping Forward Slash In Sed Command?

Nov 2, 2010

i want to replace

Code: <trus.analytics.platform.model.version>2.0.0-SNAPSHOT</trus.analytics.platform.model.version> with
Code: <trus.analytics.platform.model.version>2.0.0-b-20</trus.analytics.platform.model.version> using sed command. Code: sed -i

[Code]....

I think there is a problem with front-slash but not sure how to resolve it.

View 2 Replies View Related

Ubuntu :: Bash Command That Automatically Inserted A Quote At The End Of Email?

Feb 16, 2010

What's that bash command that automatically inserted a quote at the end of your email? Can't recall exactly, is floating round at the back of my mind.

View 4 Replies View Related

Ubuntu :: BASH Quote - Calling Commands Stored In A Variable?

Feb 19, 2010

I am having some weird problems with calling commands stored in a variable (I need to do this to assemble a command with a bunch of parameters automatically and then execute it).Example code that will replicate the weirdness:

$ echo "hello world" > "test file.txt"
$ cat "test file.txt"
hello world

[code]....

I would expect the output to be:

hello world

What happens to the quotes? I have tried various combinations of single quotes, escaped quotes, etc, but it seems like quotes in a variable are not evaluated as quotes when that variable is executed.

View 9 Replies View Related

Programming :: BASH Read Text List Zip Files Into A Single Archive?

Jul 22, 2010

AKA "zipping on the fly .. the slow-as-molasses way." The list includes full pathnames to each file, and they're all in subfolders of the same parent folder (which, unfortunately, is not the root folder of the drive or system on which the files reside). A cleaned-up and radio-ready portion of the list looks like

Quote:

.../taiga/ahqr-va-choyvp/bv0884-073.jpg
.../taiga/ahqr-va-choyvp/bv2635-073.jpg
.../taiga/ahqr-va-choyvp/bv3067-175.jpg

[code]....

What I'd like to be able to do is zip all the files in the list into a single archive, to avoid the step of having to copy them to the same location (presumably another folder on the HD) and then zip that folder. I'm more inclined to make provisions about extracting to a single folder at some other time. Is this possible in BASH, or would I have to consider a faster, more robust scripting language such as python or perl?

View 8 Replies View Related

Programming :: Connect Multiple Sockets From A Single Client To A Single Server And Keep Them Open?

Oct 13, 2010

I have question about the UNIX sockets. my goal is to connect multiple sockets from a single client to a single server and keep them open...I'm not sure if that is possible to create or not. Do you have any suggestion or an example of code?

View 1 Replies View Related

Ubuntu :: Update A Single Line Of An Output In A Bash Script?

Nov 1, 2010

This is more of a bash or scripting How do you update a single line of an output in a bash script. I have had to do the:

[Code]..

Is there a way to clear only a single line of output? my goal is to mimic a single line animation, much like the '=>' '==>' ' ===>' we have all seen in other programs.

View 3 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

Server :: Using WGET And Escaping URL With Query String?

Jul 12, 2010

There is a partnering website that provides an RSS feed to display on the website I am working on. The website displays information on the feed every time a user accesses the website. The feed changes almost every day. For bandwidth considerations and speed, I would like to download the feed once by the server using a crontab job (my website is in a linux shared hosting environment). The problem exists with the URL structure, which I have no control over.

Here is the URL:

Code:

[code]....

I am aware that there are characters that need escaping and this is where I am getting my errors. I have never written a shell-script but I am also assuming some of the characters are keywords in the Shell Scripting language or Linux I am also aware that I can avoid having to escape by enclosing the URL with single or double quotes. You will notice that the URL has BOTH single and double quotes, so its not as simple.

View 1 Replies View Related

Programming :: Unix Programming - Single Thread Server Can Support Exactly 2 Clients At Once

Sep 28, 2010

A simple TCP based chat server could allow users to use any TCP client (telnet, for example) to communicate with each other. For this question you should consider a single process, single thread server that can support exactly 2 clients at once, the server simply forwards whatever is sent from one client to the other (in both directions). Your server must not insist on any specific ordering of messages as soon as something is sent from one client it is immediately forwarded to the other client. As soon as either client terminates the connection the server can exit

View 4 Replies View Related

General :: Launch Multiple Screen Sessions From A Single Bash Script?

Jul 11, 2011

I've written a script (that doesn't work) that looks something like this:

#!/bin/sh
screen -dmS "somename" somecommand
for i in {0..5}; do
screen -dmS "name$i" anothercommand $i
done

For some reason, if I copy and paste this into a terminal, it creates 7 detached screen sessions as I expect. If I run it from within a script, however, I get only the first session, "somename," when I run screen -ls.

Edit: If the same can be accomplished another way (e.g. with multiple screen windows instead of sessions), I would be open those solutions as well.

View 3 Replies View Related

Programming :: Unix Programming - Single Process That Does Not Start Up Any Other Threads

Sep 28, 2010

i want a process that can operate as both a TCP echo server and a UDP echo server. The process can provide service to many clients at the same time, but involves a single process that does not start up any other threads.

View 3 Replies View Related

Programming :: Bash: Printing The Line Number In Bash Script?

Feb 4, 2011

I would like to know how do I print the line # in a script. My requirement is, I have a script which is about ~5000 lines long. If there are any errors happen I just exit. And I would like to add the line # of the script where the error happened.

View 3 Replies View Related

Programming :: Bash Ctrl+c Tarp And Bash Read With Timeout?

Jan 24, 2010

simple bash code:

Code:
#!/bin/bash
trap "echo 'you got me'" SIGINT SIGTERM # to trap ctrl+c
echo "Press ctrl+c during 5 sec loop"
for ((i=0;i<5;i++)); do

[Code]...

How come code behaves normally and stops when ctrl+c signal is caught and resumes, but after I use at least one timeout read in the code it looks like, if signal is caught again it doesn't pause the execution but skips the loop. If you remove -t (timeout) option from the read, both loops look the same!

View 10 Replies View Related

Programming :: Reading A Bash Variable In Bash Scripting ?

Nov 26, 2008

I have a config file that contains:

my.config:

Code:

Now in my bash script, I want to get the output /home/user instead of $HOME once read. So far, I have managed to get the $HOME variable but I can't get it to echo the variable. All I get is the output $HOME.

Here is my parse_cmd script:

Code:

View 3 Replies View Related

Programming :: Run Multiple Bash And Php Scripts From A Bash Script?

Jul 25, 2011

I have written quite a few separate bash & scripts and php scripts that up to now I have run from cron jobs. However I have to estimate how long each takes to run, before running the next and so it probably takes much longer than necessary to run them all. They have to run in order.

Now there are so many I am thinking it would be better to have a master bash script that would run one after the other, but I am not sure how to get the master script to wait before starting to run the next script. Is this possible and is there a command that will make the script wait between bash and php scripts , for them to finish, before running the next?

View 5 Replies View Related

Programming :: Bash: Get Filename And Extension Using Bash?

Jan 9, 2010

I would like to get the filename (without extension) and the extension separately. The best solution I found so far is:

Let FILE="thefilenameofsomefilesfor_instance.txt"

Code:

NAME=`echo "$FILE" | cut -d'.' -f1`
EXTENSION=`echo "$FILE" | cut -d'.' -f2`

I think it would be better to count the len and remove 3 chars to right to get the extension, but it can be macintosh filenames with have 4 chars for extensions.

View 5 Replies View Related

Programming :: Grep, Cut, Cat In A Single Command?

Apr 26, 2010

Would like to know how to cat the below output.

Code:
grep userlist_file /etc/vsftpd/vsftpd.conf | cut -c15-
Below which is the output for above command.

[code]...

View 6 Replies View Related

Programming :: Create Single Group From All Other Groups?

Mar 14, 2011

I would like to create a bash script that creates a single group from all users in other groups.

I've been at it most of the day, and I think I'm making it too complicated. I have about 100 lines of code, and it's still now working the way I would like. I'm starting to trip over my own feet with the amount of if statements and variables.

View 1 Replies View Related

Programming :: Get 2 Text Windows With A Single Program?

Apr 21, 2010

Running Ubuntu and writing simple C programs. I need 2 text windows, the one I have started in, and a second to display some debug information. I can start a second screen using popen("/usr/X11R6/bin/xterm" "w"), and I get my new text window. However, it is running a shell and I can't send any info to it!

View 4 Replies View Related

Programming :: Store 2 , 4 Tree In A Single Array?

Oct 30, 2010

I am working on an structure program and i have to represent a 2,4 tree in a class in Java using single int array and make the insert and delete functions .

View 1 Replies View Related

Ubuntu :: Stock Market EOD Quote Retriever?

Feb 22, 2010

Anyone know of of an automated stock market end of day quote retriever? Ideally this software would be a service that automatically updated a MySQL Database of stock quotes for EOD data (probably from Yahoo).

View 2 Replies View Related







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