09-25-2006
touching a file which contains slash char
i need to create a file which contains (/) character.
Any help to do this
9 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Hi,
I have a path like this c:\test\sample\programs, i need to change thiis to c:\\test\\sample\\programs. How to perform this? I tried tr command but it didn't help me.
Thanks
Vijayan (3 Replies)
Discussion started by: mvictorvijayan
3 Replies
2. Shell Programming and Scripting
Hi all,
I need to know way of inserting backward slash before forward slash. My problem is that i need to supply directory path as an argument while invoking cshell script. This argument is further used in script (i.e. sed is used to insert this path in some file). So i need to place \ in front... (2 Replies)
Discussion started by: sarbjit
2 Replies
3. Shell Programming and Scripting
Hello all,
I'd like to replace "," by "/" in a utf8 file from postion X to Y. Comma "," is also defined as delimiter.
12345678901234567890,123456789012345,12345678901234567890,
aaaa,aaaa,aaaaa ,bbb,bbbb,bbbbb ,cccccc,cc ,
Result should be... (1 Reply)
Discussion started by: fmofmo
1 Replies
4. Shell Programming and Scripting
I have an interesting one for the gurus out there that may have an idea as to why this is happening. We're currently migrating from Solaris 9 to Solaris 10 and we've run into a very strange issue. There are a bunch of shell scripts people have written throughout a directory that are used for... (4 Replies)
Discussion started by: dcarrion87
4 Replies
5. UNIX for Dummies Questions & Answers
So, I think this is a really stupid question, but I'd like to see if I am right.
If the following commands are entered:
umask 000
touch file1
umask111
touch file2
...nothing should happen...right? The touch operation isn't going to apply any changes from umask to file1 (and same to... (1 Reply)
Discussion started by: Midwest Product
1 Replies
6. Shell Programming and Scripting
hi there
Strange title? Well yes...it is strange..."touch" is driving me nutts! Trying to set the access / modified date by a bash script. For a certain time everything works well with all files. After point x the code works only for some files, for others it doesn't. After looking for the ... (4 Replies)
Discussion started by: blah0
4 Replies
7. Shell Programming and Scripting
I have a csv file that I am trying to edit. I need to remove any comma that is touching a letter. I used this command to find them.
grep , moz_places_good.csv | head -n 10 | grep ,I would think I could use some form of this to just delete the commas and not the letter before it. Just not sure... (5 Replies)
Discussion started by: cokedude
5 Replies
8. Shell Programming and Scripting
I need to add double slash into a file using "echo" command.
I tried the below from the command line and it worked.
echo "\\\\abcd\efgh" > file
more file
\\abcd\efgh
but if i use the same command within a script its showing only 1 slash
Pls help (2 Replies)
Discussion started by: gpk_newbie
2 Replies
9. UNIX for Dummies Questions & Answers
In a SCO Unix shop, I am working on the following script to move any file to its same location on the target machine (called 'othersy' here):
pwd=`pwd`
for i in "$@"
do
echo " $i "
if ; then echo 1; else echo 0; fi
rcp -p $i othersy:$pwd/$i
echo "Finished with ^ If I find a file... (4 Replies)
Discussion started by: wbport
4 Replies
LEARN ABOUT OPENSOLARIS
fnmatch
fnmatch(3C) Standard C Library Functions fnmatch(3C)
NAME
fnmatch - match filename or path name
SYNOPSIS
#include <fnmatch.h>
int fnmatch(const char *pattern, const char *string, int flags);
DESCRIPTION
The fnmatch() function matches patterns as described on the fnmatch(5) manual page. It checks the string argument to see if it matches the
pattern argument.
The flags argument modifies the interpretation of pattern and string. It is the bitwise inclusive OR of zero or more of the following flags
defined in the header <fnmatch.h>.
FNM_PATHNAME If set, a slash (/) character in string will be explicitly matched by a slash in pattern; it will not be matched by
either the asterisk (*) or question-mark (?) special characters, nor by a bracket ([]) expression.
If not set, the slash character is treated as an ordinary character.
FNM_NOESCAPE If not set, a backslash character () in pattern followed by any other character will match that second character in
string. In particular, "\" will match a backslash in string.
If set, a backslash character will be treated as an ordinary character.
FNM_PERIOD If set, a leading period in string will match a period in pattern; where the location of "leading" is indicated by the
value of FNM_PATHNAME:
o If FNM_PATHNAME is set, a period is "leading" if it is the first character in string or if it immediately fol-
lows a slash.
o If FNM_PATHNAME is not set, a period is "leading" only if it is the first character of string.
If not set, no special restrictions are placed on matching a period.
RETURN VALUES
If string matches the pattern specified by pattern, then fnmatch() returns 0. If there is no match, fnmatch() returns FNM_NOMATCH, which is
defined in the header <fnmatch.h>. If an error occurs, fnmatch() returns another non-zero value.
USAGE
The fnmatch() function has two major uses. It could be used by an application or utility that needs to read a directory and apply a pattern
against each entry. The find(1) utility is an example of this. It can also be used by the pax(1) utility to process its pattern operands,
or by applications that need to match strings in a similar manner.
The name fnmatch() is intended to imply filename match, rather than pathname match. The default action of this function is to match file-
names, rather than path names, since it gives no special significance to the slash character. With the FNM_PATHNAME flag, fnmatch() does
match path names, but without tilde expansion, parameter expansion, or special treatment for period at the beginning of a filename.
The fnmatch() function can be used safely in multithreaded applications, as long as setlocale(3C) is not being called to change the locale.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|CSI |Enabled |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
|MT-Level |MT-Safe with exceptions |
+-----------------------------+-----------------------------+
SEE ALSO
find(1), pax(1), glob(3C), setlocale(3C), wordexp(3C), attributes(5), fnmatch(5), standards(5)
SunOS 5.11 24 Jul 2002 fnmatch(3C)