Sponsored Content
Full Discussion: Single quote _error_.
Top Forums Shell Programming and Scripting Single quote _error_. Post 303027727 by wisecracker on Saturday 22nd of December 2018 11:41:07 AM
Old 12-22-2018
Hi RudiC...

Thanks a lot, as soon as I read your post I realised that I had transient, (external), versions of the command(s)...
I assumed dash's and sh's version would be the same as my transient ones instead of resident, (builtin), ones...
Never make assumptions eh! I should stick to my own quotes.
OSX 10.14.1, default bash terminal calling dash...
Code:
Last login: Sat Dec 22 16:13:19 on ttys000
AMIGA:amiga~> dash
AMIGA:\u\w> printf '%s' 'ab c \f d \n ef \q' > /tmp/ascii.txt
AMIGA:\u\w> hexdump -C /tmp/ascii.txt
00000000  61 62 20 63 20 5c 66 20  64 20 5c 6e 20 65 66 20  |ab c \f d \n ef |
00000010  5c 71                                             |\q|
00000012
AMIGA:\u\w> /usr/bin/printf '%s' 'ab c \f d \n ef \q' > /tmp/ascii.txt
AMIGA:\u\w> hexdump -C /tmp/ascii.txt
00000000  61 62 20 63 20 5c 66 20  64 20 5c 6e 20 65 66 20  |ab c \f d \n ef |
00000010  5c 71                                             |\q|
00000012
AMIGA:\u\w> echo 'ab c \f d \n ef \q' > /tmp/ascii.txt
AMIGA:\u\w> hexdump -C /tmp/ascii.txt
00000000  61 62 20 63 20 0c 20 64  20 0a 20 65 66 20 5c 71  |ab c . d . ef \q|
00000010  0a                                                |.|
00000011
AMIGA:\u\w> /bin/echo 'ab c \f d \n ef \q' > /tmp/ascii.txt
AMIGA:\u\w> hexdump -C /tmp/ascii.txt
00000000  61 62 20 63 20 5c 66 20  64 20 5c 6e 20 65 66 20  |ab c \f d \n ef |
00000010  5c 71 0a                                          |\q.|
00000013
AMIGA:\u\w> _

I wasn't actually using this in any code I just wanted a raw file as a test, that is how I came across it.
Now logged in the old grey matter to use transient versions to test with too.
Looks like 'printf' is the way to go; for quickness I never even considered 'printf'...

Many thanks matey...
These 2 Users Gave Thanks to wisecracker For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replacing a single quote

Hi there I have a data file like so below 'A/1';'T100002';'T100002';'';'01/05/2004';'31/05/2004';'01/06/2004';'08/06/2004';'1.36';'16';'0.22';'0';'0';'1.58';'0';'0';'0';'0';'0';'0';'clientes\resumen\200405\resumen_T100002_T100002_1.pdf';'';'0001';'S';'20040501';'';'02';'0';'S';'N'... (3 Replies)
Discussion started by: rjsha1
3 Replies

2. Shell Programming and Scripting

single quote

Hi I have a shell script with many lines as below: comment on column dcases.proj_seq_num is dcases_1sq; .... .... I want the above script to be as below: comment on column dcases.proj_seq_num is 'dcases_1sq'; I want to have single quotes like that as above for the entire shell... (2 Replies)
Discussion started by: dreams5617
2 Replies

3. Shell Programming and Scripting

escaping single quote

hi, echo 'abc' will give output abc how can i get output as 'abc' plz help. thanks in advance (3 Replies)
Discussion started by: javeed7
3 Replies

4. UNIX for Dummies Questions & Answers

how to print single quote in awk

Hi all, It is a very stupid problem but I am not able to find a solution to it. I am using awk to get a column from a file and I want to get the output field in between single quotes. For example, Input.txt 123 abc 321 ddff 433 dfg ........ I want output file to be as ... (6 Replies)
Discussion started by: gauravgoel
6 Replies

5. Shell Programming and Scripting

Regex in grep to match all lines ending with a double quote (") OR a single quote (')

Hi, I've been trying to write a regex to use in egrep (in a shell script) that'll fetch the names of all the files that match a particular pattern. I expect to match the following line in a file: Name = "abc" The regex I'm using to match the same is: egrep -l '(^) *= *" ** *"$' /PATH_TO_SEARCH... (6 Replies)
Discussion started by: NanJ
6 Replies

6. Shell Programming and Scripting

Replace single quote with two single quotes in perl

Hi I want to replace single quote with two single quotes in a perl string. If the string is <It's Simpson's book> It should become <It''s Simpson''s book> (3 Replies)
Discussion started by: DushyantG
3 Replies

7. Shell Programming and Scripting

single quote replacement

hi all, i have a data in the file which of the formate : 100,102,103 and the required formate is \'100\',\'102\',\'103 Idealy we need to replace , with \',\' Regards arkesh (2 Replies)
Discussion started by: arkeshtk
2 Replies

8. Shell Programming and Scripting

How to insert a single quote to each record

I have a file as: 1 New used 1 used New I need o/p as: '1' 'New' 'used' '1' 'used' 'New' (12 Replies)
Discussion started by: karumudi7
12 Replies

9. UNIX for Dummies Questions & Answers

Insert single quote and commas

Hi All, I have a set of data as below : XS012371378 Raj 23-09-12 SH128238948 Andrew 24-08-12 CH273712399 Walsh 12-10-12 JK7249923893 Nick 10-02-13 JP6383791389 Braslin 30-12-13 I want the first column to be extracted separately. I can get this using awk. awk '{print $1}' file_name ... (3 Replies)
Discussion started by: Nand Kishor
3 Replies

10. Shell Programming and Scripting

Replacing all but the first and last double quote in a line with a single quote with awk

From: 1,2,3,4,5,This is a test 6,7,8,9,0,"This, is a test" 1,9,2,8,3,"This is a ""test""" 4,7,3,1,8,"""" To: 1,2,3,4,5,This is a test 6,7,8,9,0,"This; is a test" 1,9,2,8,3,"This is a ''test''" 4,7,3,1,8,"''"Is there an easy syntax I'm overlooking? There will always be an odd number... (5 Replies)
Discussion started by: Michael Stora
5 Replies
Tk_GetDash(3)						       Tk Library Procedures						     Tk_GetDash(3)

__________________________________________________________________________________________________________________________________________________

NAME
Tk_GetDash - convert from string to valid dash structure. SYNOPSIS
#include <tk.h> int Tk_GetDash(interp, string, dashPtr) ARGUMENTS
Tcl_Interp *interp (in) Interpreter to use for error reporting. const char * string (in) Textual value to be converted. Tk_Dash *dashPtr (out) Points to place to store the dash pattern value converted from string. _________________________________________________________________ DESCRIPTION
These procedure parses the string and fills in the result in the Tk_Dash structure. The string can be a list of integers or a character string containing only ".,-_" or spaces. If all goes well, TCL_OK is returned. If string does not have the proper syntax then TCL_ERROR is returned, an error message is left in the interpreter's result, and nothing is stored at *dashPtr. The first possible syntax is a list of integers. Each element represents the number of pixels of a line segment. Only the odd segments are drawn using the "outline" color. The other segments are drawn transparent. The second possible syntax is a character list containing only 5 possible characters ".,-_ ". The space can be used to enlarge the space between other line elements, and can not occur as the first position in the string. Some examples: -dash . = -dash {2 4} -dash - = -dash {6 4} -dash -. = -dash {6 4 2 4} -dash -.. = -dash {6 4 2 4 2 4} -dash {. } = -dash {2 8} -dash , = -dash {4 4} The main difference of this syntax with the previous is that it is shape-conserving. This means that all values in the dash list will be multiplied by the line width before display. This assures that "." will always be displayed as a dot and "-" always as a dash regardless of the line width. On systems where only a limited set of dash patterns, the dash pattern will be displayed as the most close dash pattern that is available. For example, on Windows only the first 4 of the above examples are available. The last 2 examples will be displayed identically as the first one. KEYWORDS
dash, conversion Tk 8.3 Tk_GetDash(3)
All times are GMT -4. The time now is 06:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy