Sponsored Content
Top Forums Shell Programming and Scripting Problem with spaces in the path Post 302551765 by Corona688 on Wednesday 31st of August 2011 01:55:53 PM
Old 08-31-2011
The backslashes don't belong in the variable, because they don't actually exist in the name. They're just there in the tab-completion to get the whole name without the string splitting in spaces when un-quoted. So:

Code:
# unquoted
ls /bdm/sdd/compounds/AD4833XT/requests/clin/Watson_20090420/docs/MHRA\ Comments\ \&\ Responses
CMC Clinical
# quoted
ls "/bdm/sdd/compounds/AD4833XT/requests/clin/Watson_20090420/docs/MHRA Comments & Responses"

Note how the backslashes aren't needed when it's in quotes.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

cc path problem - no acceptable path found

Hello everyone, I'm a unix noob. I have a powerbook running mac os x 10.4 and for one of my classes I need to install the latest version of php (5.0.5). I'm following the instructions at http://developer.apple.com/internet/opensource/php.html to install but I've run into a problem. The... (2 Replies)
Discussion started by: kendokendokendo
2 Replies

2. Shell Programming and Scripting

problem with spaces and argument parsing

public class HelloWorld { public static void main(String args) { System.out.println("Welcome, master"); } } and I compiled using javac HelloWorld.java ] Suppose that I execute the following command directly from the shell: java -XX:OnError="gdb - %p" HelloWorld Then it works... (8 Replies)
Discussion started by: fabulous2
8 Replies

3. UNIX for Dummies Questions & Answers

Problem with spaces in directory path

Hi Gurus, I have a requirement. cat /usdd/Sample/"NDDF Plus DB"/"NDDF Descriptive and Pricing"/"NDDF BASICS 3.0"/"Pricing"/1.txt | sed 's/*|*/|/g' | sed 's/^*//'| sed 's/^*//; s/*$//' > temp.txt In unix prompt the above command is reading the file 1.txt and I am... (1 Reply)
Discussion started by: prabhutkl
1 Replies

4. UNIX for Dummies Questions & Answers

Problem with White spaces and tabs

Hi All, I am facing issues converting white spaces and tabs together in a file I am reading. Here is the command I am trying: tr -s ' '@ | sort -t@ +1n filename I guess the problem is that it is not converting the tabs to another delimiter. Also, I am supposed to accomplish this only using... (5 Replies)
Discussion started by: sh_kk
5 Replies

5. Shell Programming and Scripting

Problem iterating through PATH entries with spaces

I have a Bash script on Cygwin that tries to iterate through the directory entries in PATH. I need to convert the PATH value to a form that I can iterate through with "for var in $list; do". For instance, an excerpt from my PATH value is this: :/c/Program Files/Windows Imaging/:/c/Program... (2 Replies)
Discussion started by: dkarr
2 Replies

6. Shell Programming and Scripting

problem with spaces in filename

I have written a script to run ddrescue on a list of files. #!/bin/bash # # A script to rescue data recursively using ddrescue. srcDir=/damaged/hdd/movies/ #the source directory desDir=/new/hdd/movies/ #the destination directory... (2 Replies)
Discussion started by: colsinc
2 Replies

7. Shell Programming and Scripting

Conduct a search or test -f over a path with spaces

I am organizing my music library on a NAS server. I want to print a list of all the directories that are missing the cover art (at least one or more jpeg file). I have successfully created a file with each line containing the path to each occurance of one or more .mp3 files. That path is also... (2 Replies)
Discussion started by: godfreydanials
2 Replies

8. Shell Programming and Scripting

Set problem with spaces

#### ~]$ set "hello 'cat dog walk' money elephat" #### ~]$ echo $* | awk '{print $2}' 'cat why is the second command above showing only "'cat ? shouldn't the output be: 'cat dog walk' how can i fix this so it gives me the chosen column in its entirety? (11 Replies)
Discussion started by: SkySmart
11 Replies

9. Shell Programming and Scripting

Bash script not parsing file with spaces in path

Hi everyone, I'm trying to write my first ever shell script, the OS is Raspbian. The code I have written must be executed whenever a certain database has been modified. The database resides on a Windows server to which I have a mount point, and I have no control over the Windows server at all so... (2 Replies)
Discussion started by: gjws
2 Replies

10. Shell Programming and Scripting

Proper way to use a path with spaces in the directory name

I am using the below bash loop: or f in /media/cmccabe/My Book Western Digital/10_29and30_2015/*.bam ; do bname=`basename $f` pref=${bname%%.bam} samtools view -H $f | sed '/^@PG/d' | samtools reheader - $f > /home/cmccabe/Desktop/NGS/${pref}_newheader.bam done is the... (1 Reply)
Discussion started by: cmccabe
1 Replies
ConfigReader::DirectiveStyle(3) 			User Contributed Perl Documentation			   ConfigReader::DirectiveStyle(3)

NAME
ConfigReader::DirectiveStyle Reads a configuration file of directives and values. CONFIGURATION FILE SYNOPSIS
# comments start with a #, and blank lines are ignored Input /etc/data_source # the value follows the directive name HomePage http://www.w3.org/ # values can be quoted Comment "here is a value with trailing spaces " CODE SYNOPSIS
my $c = new ConfigReader::DirectiveStyle; directive $c 'Input', undef, '~/input'; # specify default value, # but no parsing needed required $c 'HomePage', 'new URI::URL'; # create URI::URL object ignore $c 'Comment'; # Ignore this directive. $c->load('my.config'); open(IN, $c->value("Input")); $c->define_accessors(); # creates Input() and HomePage() retrieve(HomePage()); DESCRIPTION
This class reads a common style of configuration files, where directive names are followed by a value. For each directive you can specify whether it has a default value or is required, and a function or method to use to parse the value. Errors and warnings are caught while parsing, and the location where the offending value came from (either from the configuration file, or your Perl source for default values) is reported. DirectiveStyle is a subclass of ConfigReader::Values. The methods to define the directives in the configuration file are documented there. Comments are introduced by the "#" character, and continue until the end of line. Like in Perl, the backslash character "" may be used in the directive values for the various standard sequences: tab newline return f form feed v vertical tab, whatever that is  backspace a alarm (bell) e escape 33 octal char x1b hex char The value may also be quoted, which lets you include leading or trailing spaces. The quotes are stripped off before the value is returned. DirectiveStyle itself only reads the configuration file. Most of the hard work of defining the directives and parsing the values is done in its superclass, ConfigReader::Values. You should be able to easily modify or subclass DirectiveStyle to read a different style of con- figuration file. PUBLIC METHODS
"new( [$spec] )" This static method creates and returns a new DirectiveStyle object. For information about the optional $spec argument, see Direc- tiveStyle::new(). "load($file, [$untaint])" Before calling load(), you'll want to define the directives using the methods described in ConfigReader::Values. Reads a configuration from $file. The default values for any directives not present in the file are assigned. Normally configuration values are tainted like any data read from a file. If the configuration file comes from a trusted source, you can untaint all the values by setting the optional $untaint argument to a true value (such as 'UNTAINT'). SUBCLASSABLE METHODS
You can stop reading here if you just want to use DirectiveStyle. The following methods could be overridden in a subclass to provide addi- tional or alternate functionality. "parse_line($line, $whence, $untaint)" Parses $line. $whence is a string describing the source of the line. Returns a two-element array of the directive and the value string, or the empty array () if the line is blank or only contains a comment. "parse_value_string($str, $whence)" Interprets quotes, backslashes, and comments in the value part. (Note that after the value string is returned, it will still get passed to the directive's parsing function of method if one is defined). perl v5.8.2 1996-02-14 ConfigReader::DirectiveStyle(3)
All times are GMT -4. The time now is 07:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy