Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Naming file with special characters ? Post 302933660 by Scrutinizer on Sunday 1st of February 2015 07:10:59 AM
Old 02-01-2015
There is no chance. A forward slash is one of the few characters that cannot be used in a file name, because it is used for pathname resolution.
This User Gave Thanks to Scrutinizer For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

search special characters in a file

Hello I am new to shell scripting and can anyone tell me how to check if there are any special characters in a file. Can i use grep ? thanks susie (2 Replies)
Discussion started by: cramya80
2 Replies

2. UNIX for Dummies Questions & Answers

how to see special characters in a file using vi

Hi, I have a file which has special characters. I can't see them when I "vi" the file. But I am sure there are some special un seen characters. How can I see them? Please help. Thx (6 Replies)
Discussion started by: jingi1234
6 Replies

3. UNIX for Dummies Questions & Answers

Replace Special characters in a file

Hi, I have a data like this in a file, 402003279034002000100147626030003300010000000000002000029000000 ær^M^\MÍW^H I need to replace those special char to some other char like # or $ Is there any ways to do it... I tried commands tr,sed and many but it was not able to replace because... (1 Reply)
Discussion started by: solai
1 Replies

4. UNIX for Dummies Questions & Answers

How to delete a file with special characters

I don't now exactly how I did it, but I created a file named " -C " cexdi:/home1 $ls -lt total 1801336 -rw------- 1 cexdi ced-group 922275840 23 mars 10:03 -C How do I delete this file ? cexdi:/home1 $rm -C rm: invalid option -- C Syntax : rm filename ... Doesn't work...... (5 Replies)
Discussion started by: yveslagace
5 Replies

5. Shell Programming and Scripting

Removing special characters in file

I have file special.txt with the following data. <header info> 123$ty5%98&0asd 1@356fgbv78 09*&^5jkns43( ...........some more rows. In my output file, I want to eliminate all the special characters in my file and I want all other data. need some help. (6 Replies)
Discussion started by: srivsn
6 Replies

6. Shell Programming and Scripting

escaping special characters in file name...

dear, I would like to rename files in a dir to another format, so I write a bash shell script to handle it. But my problem now is how to handle files having special characters like spaces, (, ): "a b c (d).doc" It seems that I need to escape those characters before applying the "mv" command.... (1 Reply)
Discussion started by: lau0001
1 Replies

7. Shell Programming and Scripting

Problem with Special characters in file

Hi, I am facing a below problem. Inorder to mak sure the below file is fixed width i am using the following command awk '{printf("%-375s\n", $0) } so as to add trailing spaces at the end for records of length less than 375. Input file > inp.txt 1©1234 1234 123©1 The output file is... (1 Reply)
Discussion started by: marcus_kosaman
1 Replies

8. Shell Programming and Scripting

File containing special characters

Hello All, I am facing challenges in order to transfer a file from windows to unix box,the file contains a special character '×' ,now when I am transferring the file from windows to unix that special character converted to something else like 'Ã' ,another thing I have noticed that the hardware is... (1 Reply)
Discussion started by: prarat
1 Replies

9. Shell Programming and Scripting

Substitute special Characters into a file

Hi experts :) I need to replace special characters into a file , in the followiing way : " --> "" ' --> '' _--> \_ I tried with the sed command but I'm getting and error ksh: $: not found. ksh: $: not found. sed: Function s/\/\/ cannot be parsed. Any idea ? Thanks , KOLAS... (2 Replies)
Discussion started by: Kolas79
2 Replies

10. UNIX for Beginners Questions & Answers

Rename File Name with Special Characters

I am trying to rename files with spaces and other characters and not able to be successful. FileNames: UPLOAD REFERENCE.xls UPLOAD MASS REFERENCE.XLS find /UPLOAD REFERENCE/ -depth -type f -name "* *" -exec rename " " "_" "{}" ";" The above one is successful to replace spaces... (1 Reply)
Discussion started by: eskay
1 Replies
REALPATH(3P)						     POSIX Programmer's Manual						      REALPATH(3P)

PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the correspond- ing Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. NAME
realpath -- resolve a pathname SYNOPSIS
#include <stdlib.h> char *realpath(const char *restrict file_name, char *restrict resolved_name); DESCRIPTION
The realpath() function shall derive, from the pathname pointed to by file_name, an absolute pathname that resolves to the same directory entry, whose resolution does not involve '.', '..', or symbolic links. If resolved_name is a null pointer, the generated pathname shall be stored as a null-terminated string in a buffer allocated as if by a call to malloc(). Otherwise, if {PATH_MAX} is defined as a constant in the <limits.h> header, then the generated pathname shall be stored as a null-terminated string, up to a maximum of {PATH_MAX} bytes, in the buffer pointed to by resolved_name. If resolved_name is not a null pointer and {PATH_MAX} is not defined as a constant in the <limits.h> header, the behavior is undefined. RETURN VALUE
Upon successful completion, realpath() shall return a pointer to the buffer containing the resolved name. Otherwise, realpath() shall return a null pointer and set errno to indicate the error. If the resolved_name argument is a null pointer, the pointer returned by realpath() can be passed to free(). If the resolved_name argument is not a null pointer and the realpath() function fails, the contents of the buffer pointed to by resolved_name are undefined. ERRORS
The realpath() function shall fail if: EACCES Search permission was denied for a component of the path prefix of file_name. EINVAL The file_name argument is a null pointer. EIO An error occurred while reading from the file system. ELOOP A loop exists in symbolic links encountered during resolution of the file_name argument. ENAMETOOLONG The length of a component of a pathname is longer than {NAME_MAX}. ENOENT A component of file_name does not name an existing file or file_name points to an empty string. ENOTDIR A component of the path prefix names an existing file that is neither a directory nor a symbolic link to a directory, or the file_name argument contains at least one non-<slash> character and ends with one or more trailing <slash> characters and the last pathname component names an existing file that is neither a directory nor a symbolic link to a directory. The realpath() function may fail if: EACCES The file_name argument does not begin with a <slash> and none of the symbolic links (if any) processed during pathname resolution of file_name had contents that began with a <slash>, and either search permission was denied for the current directory or read or search permission was denied for a directory above the current directory in the file hierarchy. ELOOP More than {SYMLOOP_MAX} symbolic links were encountered during resolution of the file_name argument. ENAMETOOLONG The length of a pathname exceeds {PATH_MAX}, or pathname resolution of a symbolic link produced an intermediate result with a length that exceeds {PATH_MAX}. ENOMEM Insufficient storage space is available. The following sections are informative. EXAMPLES
Generating an Absolute Pathname The following example generates an absolute pathname for the file identified by the symlinkpath argument. The generated pathname is stored in the buffer pointed to by actualpath. #include <stdlib.h> ... char *symlinkpath = "/tmp/symlink/file"; char *actualpath; actualpath = realpath(symlinkpath, NULL); if (actualpath != NULL) { ... use actualpath ... free(actualpath); } else { ... handle error ... } APPLICATION USAGE
For functions that allocate memory as if by malloc(), the application should release such memory when it is no longer required by a call to free(). For realpath(), this is the return value. RATIONALE
Since realpath() has no length argument, if {PATH_MAX} is not defined as a constant in <limits.h>, applications have no way of determining how large a buffer they need to allocate for it to be safe to pass to realpath(). A {PATH_MAX} value obtained from a prior pathconf() call is out-of-date by the time realpath() is called. Hence the only reliable way to use realpath() when {PATH_MAX} is not defined in <limits.h> is to pass a null pointer for resolved_name so that realpath() will allocate a buffer of the necessary size. FUTURE DIRECTIONS
None. SEE ALSO
fpathconf(), free(), getcwd(), sysconf() The Base Definitions volume of POSIX.1-2008, <limits.h>, <stdlib.h> COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2013 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, Copyright (C) 2013 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. (This is POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Stan- dard is the referee document. The original Standard can be obtained online at http://www.unix.org/online.html . Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html . IEEE
/The Open Group 2013 REALPATH(3P)
All times are GMT -4. The time now is 06:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy