String containing "


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting String containing "
# 1  
Old 12-13-2009
String containing "

I need to create a string as shown below using csh to no avail

-B10f5:"Distance, Mm":/a10f5:"Time, min":/a10f5:."S-R Times":WSne

The problem is that I'm finding it hard to put the " inside the string.

Something like below did not work

Code:
set TITLE = "S-R Times"
set DESCX = "Distance,Mm"
set DESCY = "Time,min"

set TRY =  "-B10f5:""""$DESCX"""":/a10f5:""""$DESCY":/a10f5:.""""$TITLE"""":WSne"

Also tried something like this

Code:
set TRY = `echo "-B10f5:""$DESCX"""`

and then using the backslash like \"

Code:
set TRY = "-B10f5:\""$DESCX"\""


Last edited by kristinu; 12-13-2009 at 06:43 PM..
# 2  
Old 12-13-2009
Please stop using this dreadful shell. There exists much better ones!

Code:
set TRY = "-B10f5:"\"""$DESCX""\"":/a10f5:"\"""$DESCY""\"":/a10f5:."\""$TITLE"\"":WSne"


-B10f5:"Distance,Mm":/a10f5:"Time,min":/a10f5:."S-R Times":WSne

How that works, makes no sense to me!
# 3  
Old 12-13-2009
In fact it doesn't Smilie

---------- Post updated at 05:52 PM ---------- Previous update was at 05:51 PM ----------

Tried using the \" to print only ".

---------- Post updated at 05:52 PM ---------- Previous update was at 05:52 PM ----------

The problem is that I am using other's script.

I've actually done it now using

Code:
set TRY = `echo "-B10f5:"\"$DESCX\"":/a10f5:"\"$DESCY\"":/a10f5:."\"$TITLE\"":WSne"`

# 4  
Old 12-13-2009
use a pair of apostrophes to quote your value.

Code:
set TRY = '-B10f5:"Distance, Mm":/a10f5:"Time, min":/a10f5:."S-R Times":WSne '

read here for additional info about handling special characters on c shell.
# 5  
Old 12-13-2009
I have solved the problem now

---------- Post updated at 06:41 PM ---------- Previous update was at 06:11 PM ----------

Was wondering what's good shell to use these days

Last edited by kristinu; 12-13-2009 at 07:40 PM..
# 6  
Old 12-13-2009
Quote:
Originally Posted by kristinu
Was wondering what's good shell to use these days
ksh93 Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Delete all log files older than 10 day and whose first string of the first line is "MSH" or "<?xml"

Dear Ladies & Gents, I have a requirement to delete all the log files in /var/log/test directory that are older than 10 days and their first line begin with "MSH" or "<?xml" or "FHS". I've put together the following BASH script, but it's erroring out: for filename in $(find /var/log/test... (2 Replies)
Discussion started by: Hiroshi
2 Replies

2. Shell Programming and Scripting

grep with "[" and "]" and "dot" within the search string

Hello. Following recommendations for one of my threads, this is working perfectly : #!/bin/bash CNT=$( grep -c -e "some text 1" -e "some text 2" -e "some text 3" "/tmp/log_file.txt" ) Now I need a grep success for some thing like : #!/bin/bash CNT=$( grep -c -e "some text_1... (4 Replies)
Discussion started by: jcdole
4 Replies

3. Shell Programming and Scripting

Removing "^M" from the end of a String (i.e. "Ctrl+M")?

Hello All, I have an Expect script that ssh's to a remote server and runs some commands before exiting. One of the commands I run is the "hostname" Command. After I run this command I save the output using this line in the code below... Basically it executes the hostname command, then I... (2 Replies)
Discussion started by: mrm5102
2 Replies

4. Shell Programming and Scripting

tcsh - understanding difference between "echo string" and "echo string > /dev/stdout"

I came across and unexpected behavior with redirections in tcsh. I know, csh is not best for redirections, but I'd like to understand what is happening here. I have following script (called out_to_streams.csh): #!/bin/tcsh -f echo Redirected to STDOUT > /dev/stdout echo Redirected to... (2 Replies)
Discussion started by: marcink
2 Replies

5. Shell Programming and Scripting

how to use "cut" or "awk" or "sed" to remove a string

logs: "/home/abc/public_html/index.php" "/home/abc/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" how to use "cut" or "awk" or "sed" to get the following result: abc abc xyz xyz xyz (8 Replies)
Discussion started by: timmywong
8 Replies

6. Shell Programming and Scripting

Using sed to find text between a "string " and character ","

Hello everyone Sorry I have to add another sed question. I am searching a log file and need only the first 2 occurances of text which comes after (note the space) "string " and before a ",". I have tried sed -n 's/.*string \(*\),.*/\1/p' filewith some, but limited success. This gives out all... (10 Replies)
Discussion started by: haggismn
10 Replies

7. Shell Programming and Scripting

script that answers y unless output has a string "STRING" in it

Hi all, I have the following script which I use to chek the output of jobs submitted to a PBS server. #!/bin/sh # #recover.sh # check() { echo "Do you want to proceed?" read answer if ; then echo "... proceeding ..." else echo "--------- Aborting -----------"... (0 Replies)
Discussion started by: faizlo
0 Replies

8. Shell Programming and Scripting

Remove path string from file (string contains "/")

This is the way sed -i 's/home/$USER/.config/hello_there//g' /home/$USER/.gnomerc But, as far as I saw you cannot add any "/" in the string you want to remove.... So, what should I do in order to remove this path (which contains "/") ?:confused: (7 Replies)
Discussion started by: hakermania
7 Replies

9. Shell Programming and Scripting

input string="3MMTQSZ348GGMZRQWMJM4SD6M";output string="3MMTQ-SZ348-GGMZR-QWMJM-4SD6

input string="3MMTQSZ348GGMZRQWMJM4SD6M" output string="3MMTQ-SZ348-GGMZR-QWMJM-4SD6M" using linux shell script (4 Replies)
Discussion started by: pankajd
4 Replies

10. UNIX for Dummies Questions & Answers

search excat string in another string (grep "fails")

hello, i have an statement which i have to correct because it shows the wrong result. i want to search an excat string in another string, command "grep" shows the wrong result: example: STRINGS="string1 string2 string3" search_string="string" incorrect: if then echo "not... (0 Replies)
Discussion started by: bora99
0 Replies
Login or Register to Ask a Question