Sponsored Content
Full Discussion: Spaces in File Name issue
Homework and Emergencies Emergency UNIX and Linux Support Spaces in File Name issue Post 302367647 by ahmad.diab on Tuesday 3rd of November 2009 07:22:25 AM
Old 11-03-2009
the "${Varname}" is available in bash only.

---------- Post updated at 07:19 AM ---------- Previous update was at 07:18 AM ----------

Quote:
Originally Posted by ahmad.diab
the "${Varname}" is available in bash only.
sorry not only in bash but also in KSH.
BR

---------- Post updated at 07:22 AM ---------- Previous update was at 07:19 AM ----------

kindly find some details and example below:-

Code:
Quoting means just that, bracketing a string in quotes. This has the effect of protecting special characters in
the string from reinterpretation or expansion by the shell or shell script. (A character is "special" if it has an
interpretation other than its literal meaning, such as the wild card character -- *.)
bash$ ls -l [Vv]*
-rw-rw-r-- 1 bozo bozo 324 Apr 2 15:05 VIEWDATA.BAT
-rw-rw-r-- 1 bozo bozo 507 May 4 14:25 vartrace.sh
-rw-rw-r-- 1 bozo bozo 539 Apr 14 17:11 viewdata.sh
bash$ ls -l '[Vv]*'
ls: [Vv]*: No such file or directory

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Strip leading and trailing spaces only in a shell variable with embedded spaces

I am trying to strip all leading and trailing spaces of a shell variable using either awk or sed or any other utility, however unscuccessful and need your help. echo $SH_VAR | command_line Syntax. The SH_VAR contains embedded spaces which needs to be preserved. I need only for the leading and... (6 Replies)
Discussion started by: jerardfjay
6 Replies

2. Shell Programming and Scripting

Directories with spaces in name - looking for help with questions in that issue

I need to work with 'nice' directory names which have some spaces in name, and that brings some questions and not-understanding. Would some expert help me out how to deal with that?! My task is to document some processing, running from some script. I do need to have spaces in directories... (2 Replies)
Discussion started by: alex_5161
2 Replies

3. UNIX for Dummies Questions & Answers

how to append spaces(say 10 spaces) at the end of each line based on the length of th

Hi, I have a problem where I need to append few spaces(say 10 spaces) for each line in a file whose length is say(100 chars) and others leave as it is. I tried to find the length of each line and then if the length is say 100 chars then tried to write those lines into another file and use a sed... (17 Replies)
Discussion started by: prathima
17 Replies

4. Shell Programming and Scripting

Removing blank spaces, tab spaces from file

Hello All, I am trying to remove all tabspaces and all blankspaces from my file using sed & awk, but not getting proper code. Please help me out. My file is like this (<b> means one blank space, <t> means one tab space)- $ cat file NARESH<b><b><b>KUMAR<t><t>PRADHAN... (3 Replies)
Discussion started by: NARESH1302
3 Replies

5. UNIX for Dummies Questions & Answers

cleaning up spaces from fixed width file while converting to csv file

Open to a sed/awk/or perl alternative so that i can stick command into my bash script. This is a problem I resolve using a combination of cut commands - but that is getting convoluted. So would really appreciate it if someone could provide a better solution which basically replaces all... (3 Replies)
Discussion started by: svn
3 Replies

6. Shell Programming and Scripting

File Name with spaces

I need to read pdf files copied in a unix directory.I tried using the for loop with find command but the file names is cutting off at the spaces.Below is the code I tried. for FILENAME in `find $DIR_FILE/ -name "*.pdf" -mindepth 1 -maxdepth 1 -mmin +60 ` ##Needs to be changed later +60 to -60 do... (4 Replies)
Discussion started by: Beena
4 Replies

7. Shell Programming and Scripting

Issue with spaces in Java command line options

Hi, I am writing a shell script to build Java options dynamically in a variable array and pass them to java.exe. If an option value contains a space, I cannot find a way to get it interpreted correctly. Here is my example: #!/bin/bash JAVA_HOME=/opt/jvm/jre1.5.0_18 JAVA_OPTS=("-Xms256m... (4 Replies)
Discussion started by: Romain
4 Replies

8. Shell Programming and Scripting

Conversion of spaces Text file into CSV format file

Input file (each line is separaed by spaces )given below: Name Domain Contact Phone Email Location ----------------------- ------------------------------------------------ ------- -----... (18 Replies)
Discussion started by: sreenath1037
18 Replies

9. Shell Programming and Scripting

White spaces issue with shell variables

Hi all, I've a requirement as below Source file src.txt sample data: A<10 white spaces>B12<5 white spaces>C<17 white spaces> A1<5 white spaces>B22<5 white spaces>C13<17 white spaces> when I'm fetching a record from this file into a shell variable like below: vRec=`head -1 src.txt... (2 Replies)
Discussion started by: madhu_1126
2 Replies

10. Shell Programming and Scripting

Need assistance with a file issue and a terminal issue

Hello everyone, I'm in need of some assistance. I'm currently enrolled in an introductory UNIX shell programming course and, well halfway through the semester, we are receiving our first actual assignment. I've somewhat realized now that I've fallen behind, and I'm working to get caught up, but for... (1 Reply)
Discussion started by: MrMagoo22
1 Replies
MAIRIXRC(5)							File Formats Manual						       MAIRIXRC(5)

NAME
mairixrc - configuration file for mairix(1) SYNOPSIS
$HOME/.mairixrc DESCRIPTION
The mairixrc file tells mairix where your mail folders are located. It also tells mairix where the results of searches are to be written. mairix searches for this file at $HOME/.mairixrc unless the -f option is used. The directives base, mfolder, and database must always appear in the file. There must also be some folder definitions (using the maildir, mh, or mbox) directives. Comments Any line starting with a '#' character is treated as a comment. Directives base=base-directory This defines the path to the common parent directory of all your maildir folders. If the path is relative, it is treated as relative to the location of the mairixrc file. maildir=list-of-folder-specifications This is a colon-separated list of the Maildir folders (relative to `base') that you want indexed. Any entry that ends `...' is recursively scanned to find any Maildir folders underneath it. More than one line starting with `maildir' can be included. In this case, mairix joins the lines together with colons as though a single list of folders had been given on a single very long line. Each colon-separated entry may be a wildcard. See the discussion under mbox (below) for the wildcard syntax. For example maildir=zzz/foo*... will match maildir folders like these (relative to the base-directory) zzz/foobar/xyz zzz/fooquux zzz/foo zzz/fooabc/u/v/w and maildir=zzz/foo[abc]* will match maildir folders like these (relative to the folder_base) zzz/fooa zzz/fooaaaxyz zzz/foobcd zzz/fooccccccc If a folder name contains a colon, you can write this by using the sequence ':' to escape the colon. Otherwise, the backslash character is treated normally. (If the folder name actually contains the sequence ':', you're out of luck.) mh=list-of-folder-specifications This is a colon-separated list of the MH folders (relative to `base') that you want indexed. Any entry that ends '...' is recur- sively scanned to find any MH folders underneath it. More than one line starting with 'mh' can be included. In this case, mairix joins the lines together with colons as though a single list of folders had been given on a single very long line. Each colon-separated entry may be a wildcard, see the discussion under maildir (above) and mbox (below) for the syntax and semantics of specifying wildcards. recognizes the types of MH folders created by the following email applications: * xmh * sylpheed * claws-mail * evolution * NNML * Mew mbox=list-of-folder-specifications This is a colon-separated list of the mbox folders (relative to `base') that you want indexed. Each colon-separated item in the list can be suffixed by '...'. If the item matches a regular file, that file is treated as a mbox folder and the '...' suffix is ignored. If the item matches a directory, a recursive scan of everything inside that directory is made, and all regular files are initially considered as mbox folders. (Any directories found in this scan are themselves scanned, since the scan is recursive.) Each colon-separated item may contain wildcard operators, but only in its final path component. The wildcard operators currently supported are * Match zero or more characters (each character matched is arbitrary) ? Match exactly one arbitrary character [abcs-z] Character class : match a single character from the set a, b, c, s, t, u, v, w, x, y and z. To include a literal ']' in the class, place it immediately after the opening '['. To include a literal '-' in the class, place it immediately before the closing ']'. If these metacharacters are included in non-final path components, they have no special meaning. Here are some examples mbox=foo/bar* matches 'foo/bar', 'foo/bar1', 'foo/barrrr' etc mbox=foo*/bar* matches 'foo*/bar', 'foo*/bar1', 'foo*/barrrr' etc mbox=foo/* matches 'foo/bar', 'foo/bar1', 'foo/barrrr', 'foo/foo', 'foo/x' etc mbox=foo... matches any regular file in the tree rooted at 'foo' mbox=foo/*... same as before mbox=foo/[a-z]*... matches 'foo/a', 'foo/aardvark/xxx', 'foo/zzz/foobar', 'foo/w/x/y/zzz', but not 'foo/A/foobar' Regular files that are mbox folder candidates are examined internally. Only files containing standard mbox 'From ' separator lines will be scanned for messages. If a regular file has a name ending in '.gz', and gzip support is compiled into the mairix binary, the file will be treated as a gzipped mbox. If a regular file has a name ending in '.bz2', and bzip support is compiled into the mairix binary, the file will be treated as a bzip2'd mbox. More than one line starting with 'mbox' can be included. In this case, mairix joins the lines together with colons as though a sin- gle list of folders had been given on a single very long line. mairix performs no locking of mbox folders when it is accessing them. If a mail delivery program is modifying the mbox at the same time, it is likely that one or messages in the mbox will never get indexed by mairix (until the database is removed and recreated from scratch, anyway.) The assumption is that mairix will be used to index archive folders rather than incoming ones, so this is unlikely to be much of a problem in reality. mairix can support a maximum of 65536 separate mboxes, and a maximum of 65536 messages within any one mbox. omit=list-of-glob-patterns This is a colon-separated list of glob patterns for folders to be omitted from the indexing. This allows wide wildcards and recur- sive elements to be used in the maildir,mh, andmbox directives, with the omit option used to selectively remove unwanted folders from the folder lists. Within the glob patterns, a single '*' matches any sequence of characters other than '/'. However '**' matches any sequence of characters including '/'. This allows glob patterns to be constructed which have a wildcard for just one directory component, or for any number of directory components. The _omit_ option can be specified as many times as required so that the list of patterns doesn't all have to fit on one line. As an example, mbox=bulk... omit=bulk/spam* will index all mbox folders at any level under the 'bulk' subdirectory of the base folder, except for those folders whose names start 'bulk/spam', e.g. 'bulk/spam', 'bulk/spam2005' etc. In constrast, mbox=bulk... omit=bulk/spam** will index all mbox folders at any level under the 'bulk' subdirectory of the base folder, except for those folders whose names start 'bulk/spam', e.g. 'bulk/spam', 'bulk/spam2005', 'bulk/spam/2005', 'bulk/spam/2005/jan' etc. nochecks This takes no arguments. If a line starting with nochecks is present, it is the equivalent of specifying the -Q flag to every indexing run. mfolder=match-folder-name This defines the name of the folder (within the directory specified by base) into which the search mode writes its output. (If the mformat used is 'raw' or 'excerpt', then this setting is not used and may be omitted.) The mfolder setting may be over-ridden for a particular search by using the -o option to mairix. mairix will refuse to output search results to a folder that appears to be amongst those that are indexed. This is to prevent acci- dental deletion of emails. If the first character of the mfolder value is '/' or '.', it is taken as a pathname in its own right. This allows you to specify absolute paths and paths relative to the current directory where the mfolder should be written. Otherwise, the value of mfolder is appended to the value of base, in the same way as for the source folders. mformat=format This defines the type of folder used for the match folder where the search results go. There are four valid settings for format, namely 'maildir', 'mh', 'mbox', 'raw' or 'excerpt'. If the 'raw' setting is used then mairix will just print out the path names of the files that match and no match folder will be created. If the 'excerpt' setting is used, mairix will also print out the To:, Cc:, From:, Subject: and Date: headers of the matching messages. 'maildir' is the default if this option is not defined. The set- ting is case-insensitive. database=path-to-database This defines the path where mairix's index database is kept. You can keep this file anywhere you like. Currently, mairix will place a single database file at the location indicated by path-to-database. However, a future version of mairix may instead place a directory containing several files at this location. path-to-database should be an absolute pathname (starting with '/'). If a relative pathname is used, it will be interpreted rela- tive to the current directory at the time mairix is run, (not relative to the location of the mairixrc file or anything like that.) Expansions The part of each line in '.mairixrc' following the equals sign can contain the following types of expansion: Home directory expansion If the sequence '~/' appears at the start of the text after the equals sign, it is expanded to the user's home directory. Example: database=~/Mail/mairix_database Environment expansion If a '$' is followed by a sequence of alpha-numeric characters (or '_'), the whole string is replaced by looking up the correspond- ing environment variable. Similarly, if '$' is followed by an open brace ('{'), everything up to the next close brace is looked up as an environment variable and the result replaces the entire sequence. Suppose in the shell we do export FOO=bar and the '.mairixrc' file contains maildir=xxx/$FOO mbox=yyy/a${FOO}b this is equivalent to maildir=xxx/bar mbox=yyy/abarb If the specified environment variable is not set, the replacement is the empty string. NOTES
An alternative path to the configuration file may be given with the -f option to mairix(1). January 2006 MAIRIXRC(5)
All times are GMT -4. The time now is 12:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy