Sponsored Content
Top Forums Shell Programming and Scripting Add backslash and apostrophe to string in variable. Post 303018141 by primo102 on Wednesday 30th of May 2018 04:21:40 AM
Old 05-30-2018
Add backslash and apostrophe to string in variable.

Hi All

I want to add backslash and apostrophe to variable in my bash script.


I have my variable:
Code:
USER_LIST=USER1,USER2,USER3

and I want something like this:
Code:
USER_LIST_DEL=/'USER1/',/'USER2/',/'USER3/'

any ideas ??
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

How to handle backslash in grep string

Hi , I am doing invert grep using -v but the string contain "/" which break the grep command and it do not skip the lines with "/" on it. Diffu.txt ======== 1159c1159 < <td align="right" valign="middle" class="paddingRight2px" id="featureListItemChannelButton7466"> --- > <td... (6 Replies)
Discussion started by: rajbal
6 Replies

2. Shell Programming and Scripting

bash - add backslash in front of variables w/ spaces

Hello, Im writing a script that works by recursively going into directories with find. But I have some directories that have spaces in them.. so I need to parse the variables to add a backslash before the spaces. Im not exactly sure how how to do this in bash, and honestly I dont think I know... (3 Replies)
Discussion started by: trey85stang
3 Replies

3. Shell Programming and Scripting

perl string matching problem (two backslash)

I have a few .tex files generated with html2latex. They have some extra \\ that generate error with pdflatex, so I would like to get rid of them. This perl -p -i -e s/\\\\//g myfile.tex with or without simple or double quote remove all of the backslashes, also the single ones needed by tex. How... (2 Replies)
Discussion started by: ahsog
2 Replies

4. Shell Programming and Scripting

sed variable and backslash

I am trying to write a bash shell script, which extracts a sentence from a dynamically created dynamic file and passes it as a variable to sed and uses that sentence as a starting point to pull the content from a log file. the key part of the script is this key=`cat /tmp/dynamic` sed -n... (3 Replies)
Discussion started by: fedora
3 Replies

5. Shell Programming and Scripting

Cut on last backslash on hyperlink string-sed/awk??

hyper link- abc:8081/xyz/2.5.6/rtyp-2.5.6.jar Needs to get "rtyp-2.5.6.jar" i.e character after last backslash "/" how to do this using sed/awk?? help is highly appreciated. (7 Replies)
Discussion started by: kkscm
7 Replies

6. Shell Programming and Scripting

Replace apostrophe with backslash apostrophe

I'm coding using BASH and have a requirement to replace apostrophes with backslash apostrophes. For example below: I am here 'in my room' ok Would be changed to: I am here /'in my room/' ok The original text is coming from a field in a MySql database and is being used by another process that... (5 Replies)
Discussion started by: dbjock
5 Replies

7. UNIX for Dummies Questions & Answers

Replace backslash at the end of the string using sed command

I have text file which is a tab delimited one. Sample data from the file is shown below: unix is\ great\ os linux\ is superb I want to replace that backslash with empty string preserving the tab delimiter. Output should be unix is great os linux is ... (3 Replies)
Discussion started by: p.akhilreddy4u
3 Replies

8. Shell Programming and Scripting

Passing backslash character to awk variable

Hi All. I have a file that contains some special characters and I'm trying to use AWK to search for lines between <pattern1> and <pattern2>. As an example: I need the lines between the line containing ' select_id="x_0 ' and the line containing the next instance of ' from '. This is a file... (5 Replies)
Discussion started by: Mudshark
5 Replies

9. Shell Programming and Scripting

"set variable with spaces and apostrophe after s"

Hi Guys, I have a variable such that: set x = (Session,Date,Type,Receive Coil Name,Manufacturer,Manufacturer's Model Name) foreach i ($x) echo $i end I would like to read each variable one by one like: Session Date Type Receive Coil Name Manufacturer Manufacturer's Model Name Is... (1 Reply)
Discussion started by: dixits
1 Replies

10. UNIX for Beginners Questions & Answers

Check if string variable is a subset of another string variable

Below is my ksh shell script where I need to check if variable fileprops is a subset of $1 argument. echo "FILE PROPERTY: $fileprops" echo "PARAMETER3: $1" if ; then echo "We are Good. $line FILE is found to be INTACT !! " else echo... (2 Replies)
Discussion started by: mohtashims
2 Replies
audio_support(7I)						  Ioctl Requests						 audio_support(7I)

NAME
audio_support - audio driver support routines and interface SYNOPSIS
#include <sys/audio.h> DESCRIPTION
The audio support module supports audio drivers that use the new audio driver architecture. It also provides a limited number of ioctl(2) functions for application programmers. DATA STRUCTURES
The following data structures are defined to manage the different audio device types and channels. Device Types The following enumeration lists a number of generic device types. typedef enum { UNDEFINED, AUDIO, AUDIOCTL, USER1, USER2, USER3 } audio_device_type_e; Currently, the Solaris audio mixer implements only the AUDIO and AUDIOCTL audio device types. See the mixer(7I) manual page for details. The USER1, USER2 and USER3 device types allow third parties to write audio personality modules of their own. Channel Structure This structure is used to get and set state information on individual channels. struct audio_channel { pid_t pid; /* application's process ID */ uint_t ch_number; /* device channel */ audio_device_type_e dev_type; /* device type */ uint_t info_size; /* size of channel's */ /* info structure */ void *info; /* channel state information */ ; typedef struct audio_channel audio_channel_t; The ch_number must specify the specific channel number to get or set. When the ioctl() returns, the pid contains the process ID of the process that has that channel open and dev_type will contain the device type. If pid is 0 (zero), then the channel is not open. The pointer *info must point to a buffer large enough to hold whatever audio device-related state structure that may be returned. Currently, only the audio_info_t structure is returned. See the audio(7I) and mixer(7I) man pages for more information. IOCTLS
The audio support driver provides the following ioctls(): AUDIO_GET_CH_NUMBER This ioctl() returns the channel number pointed to by the file descriptor. It is returned in the integer pointer of the ioctl() argument. AUDIO_GET_CH_TYPE This ioctl() returns the type of channel the process has open. It is returned in the audio_device_type_e enumeration pointer of the ioctl() argument. AUDIO_GET_NUM_CHS This ioctl() returns the number of channels the device supports. It is returned in the integer pointer of the ioctl() argument. MACROS
The following macro can be used to initialize data structures. The established convention is that the state corresponding to a field set to -1 will not be modified. AUDIO_INIT(I, S) Where I is a pointer to an info structure and S is the size of that structure. The following code segment demonstrates how to use this macro: audio_info_t info; AUDIO_INIT(&info, sizeof(info)); info.play.port = AUDIO_HEADPHONE; err = ioctl(audio_fd, AUDIO_SETINFO, &info); ERRORS
EINVAL The ioctl() is invalid for this file descriptor. The audio_channel_t structure's info pointer does not point to a buffer, or the ch_number is bad. ENOMEM The ioctl() failed due to lack of memory. FILES
/usr/share/audio/samples Audio sample files ATTRIBUTES
See attributes(5) for a description of the following attributes: +-----------------------------+------------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | |Architecture |SPARC, x86 | |Availability |SUNWaudd, SUNWauddx, SUNWaudh | |Stability Level |Evolving | +-----------------------------+------------------------------+ SEE ALSO
ioctl(2), attributes(5), audio(7I), mixer(7I), streamio(7I) FUTURE DIRECTIONS
Over time, additional audio personality modules will be added. Audio application programmers are encouraged to review this man page with each Solaris release for new audio personality modules. SunOS 5.10 2 January 2002 audio_support(7I)
All times are GMT -4. The time now is 04:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy