Trouble with Backslashes


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Trouble with Backslashes
# 1  
Old 09-15-2006
Trouble with Backslashes

Hi folks,

there are windows device names in the sixth column of a comma separated file. A example device name is:
\\.\Tape0

I don't get the all string in to a variable, because of the preceding backslash. The first backslash is just cut off and my attempts to manipulate the string afterward were not successful. Is someone out there, who knows what I'm doing wrong?

for i in $(cat $INPUTFILE)
do
DEVICE=`echo $i | awk -F, '/Tape/{print $6}'`
done

Thanks in advance.
wibo1
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to add backslashes to end of certain lines of text

I'd like to write up notes in a relatively readable format and then use a shell script to add LaTeX formatting. Specifically, I'm trying to figure out how to add the LaTeX newline character (\\) to the end of lines without \begin{} or \end{} statements example notes file: \begin{enumerate} --... (2 Replies)
Discussion started by: icskittles
2 Replies

2. UNIX for Dummies Questions & Answers

printing backslashes

printf "\\" prints a backslash.how we can print multiple backslashes such as "\\\\\\\\\\\\\\\\\\\\". Thanks (4 Replies)
Discussion started by: pandeesh
4 Replies

3. Programming

Trouble with C

Hey, i am having a problem First, i know java well and i have used C++ on occasion so i thought i would be able to deal with a class where they program in C. unfortunately i have hit some speed bumps that i am having problems. Here is my problem: I have a structure cache_t in the sample... (0 Replies)
Discussion started by: zephoid
0 Replies

4. Shell Programming and Scripting

escaping backslashes to evaluate paths

Hi there, i am struggling with this one, basically i want to replace an existing path string in a file with a new one, but the new one contains slashes which causes problems with "sed", i thought i could change the replacement string into a variable but of course when the variable is evaluated... (4 Replies)
Discussion started by: surfbus78
4 Replies

5. Shell Programming and Scripting

Replacing 3 backslashes with 2 in a string

Hi, I have a requirement where i need to replace 3 backslashes with 2 in the below mentioned string, but i am facing problem with backslashes. However i tried the option below but doesnt work. My input remains a constant as i receive it from my upstream. Input String= "-rfile... (3 Replies)
Discussion started by: kk_madrid
3 Replies

6. UNIX for Dummies Questions & Answers

Inserting commas and replacing backslashes with commas

Hi, Newbie here. I have a file that consists of data that I want to convert to a csv file. For example: Jul 20 2008 1111 / visit home / BlackBerry8830/4.2.2 Profile/MIDP-2.0 Configuration/CLOC-1.1 VendorID/105 Jul 21 2008 22222 / add friend / BlackBerry8830/4.2.2 Profile/MIDP-2.0... (3 Replies)
Discussion started by: kangaroo
3 Replies

7. UNIX for Dummies Questions & Answers

Backslashes in Filenames

Using a small script, I automatically generated some text logs. The files ended being undownloadable, unopenable and undeletable. Upon further investigation, the files ended up looking like this: log\r log2\r log3\r I've tried a few different things, including double slashing before the... (6 Replies)
Discussion started by: shepherdsflock
6 Replies

8. Solaris

Trouble with tr

I'm not sure where to post this but it's happening on a SunOS 5.8 server so I'll try here. I've discovered some unexpected behavior when using tr. For example: echo a | tr Z echo b | tr a echo a | tr B echo a | tr B echo a | tr A (8 Replies)
Discussion started by: Mike@Work
8 Replies

9. Shell Programming and Scripting

How to echo 4 backslashes more easy ?

How to echo 4 backslashes more easy ? I can use 16 to echo 4 backslashes. # echo \\ \ # echo \\\\ \ # echo \\\\\\ \\ # echo \\\\\\\\ \\ # echo \\\\\\\\\\ \\\ # echo \\\\\\\\\\\\ \\\ # echo \\\\\\\\\\\\\\ \\\\ (4 Replies)
Discussion started by: sun-guy
4 Replies

10. UNIX for Dummies Questions & Answers

The trouble about SU ...

Hi all, having read lots of posts about SU I don't quiet understand this : I'm doing regular backups of my database (u betta do) and therefore use su - username -c "sqlscript special data_base" in a unixscript which is even using cron. (yep!) Now I need some other script, still with this... (4 Replies)
Discussion started by: nulnul7
4 Replies
Login or Register to Ask a Question
add_allocatable(1M)					  System Administration Commands				       add_allocatable(1M)

NAME
add_allocatable - add entries to allocation databases SYNOPSIS
/usr/sbin/add_allocatable [-f] [-s] [-d] -n name -t type -l device-list [-a authorization] [-c clean] [-o key=value] DESCRIPTION
add_allocatable creates new entries for user allocatable devices that are to be managed by the device allocation mechanism. add_allocatable can also be used to update existing entries of such devices. add_allocatable can also create and update entries for non-allocatable devices, such as printers, whose label range is managed by the device allocation mechanism. add_allocatable can be used in shell scripts, such as installation scripts for driver packages, to automate the administrative work of set- ting up a new device. Use list_devices(1) to see the names and types of allocatable devices, their attributes, and device paths. OPTIONS
-f Force an update of an already-existing entry with the specified information. add_allocatable exits with an error if this option is not specified when an entry with the specified device name already exists. -s Turn on silent mode. add_allocatable does not print any error or warning messages. -d If this option is present, add_allocatable updates the system-supplied default attributes of the device type specified with -t. -n name Adds or updates an entry for device that is specified by name. -t type Adds or updates device entries that are of a type that are specified by type. -l device-list Adds or updates device paths to the device that is specified with -n. Multiple paths in device-list must be separated by white spaces and the list must be quoted. -a authorization Adds or updates the authorization that is associated with either the device that is specified with -n or with devices of the type that is specified with -t. When more than one authorization is specified, the list must be separated by commas and must be quoted. When the device is not allocatable, authorization is specified with an asterisk (*) and must be quoted. When the device is allocatable by any user, authorization is specified with the at sign (@) and must be quoted. Default authorization is '@'. -c clean Specifies the device_clean(5) program clean to be used with the device that is specified with -n or with devices of the type that is specified with -t. The default clean program is /bin/true. -o key=value Accepts a string of colon-separated key=value pairs for a device that is specified with -n or with devices of the type that is specified with -t. The following keys are currently interpreted by the system: minlabel The minimum label at which the device can be used. maxlabel The maximum label at which the device can be used. class Specifies a logical grouping of devices. For example, all Sun RayTM devices of all device types is a logi- cal grouping. The class keyword has no default value. xdpy Specifies the display name of the X session. This keyword is used to identify devices that are associated with the X session. The xdpy keyword has no default value. EXIT STATUS
When successful, add_allocate returns an exit status of 0 (true). add_allocate returns a nonzero exit status in the event of an error. The exit codes are as follows: 1 Invocation syntax error 2 Unknown system error 3 An entry already exists for the specified device. This error occurs only when the -f option is not specified. 4 Permission denied. User does not have DAC or MAC access record updates. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +------------------------------+----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +------------------------------+----------------------------+ |Availability |SUNWtsu | +------------------------------+----------------------------+ |Interface Stability |See below. | +------------------------------+----------------------------+ The invocation is Uncommitted. The options are Uncommitted. The output is Not-an-Interface. SEE ALSO
allocate(1), deallocate(1), list_devices(1), remove_allocatable(1M), attributes(5), device_clean(5) NOTES
The functionality described on this manual page is available only if the system is configured with Trusted Extensions. SunOS 5.11 20 Jul 2007 add_allocatable(1M)