![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| spaces in filenames | Bab00shka | Shell Programming and Scripting | 8 | 09-30-2008 03:13 PM |
| perl script to list filenames that do not contain given string | royalibrahim | Shell Programming and Scripting | 21 | 04-22-2008 02:55 PM |
| spaces in filenames, for do | naviztirf | Shell Programming and Scripting | 4 | 10-17-2007 06:08 PM |
| Unix filenames and spaces | x96riley3 | Shell Programming and Scripting | 2 | 01-31-2007 07:07 PM |
| spaces in filenames | Hitori | Shell Programming and Scripting | 4 | 07-04-2006 05:35 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
How to list filenames with spaces in shell script
Hi,
I want to list all the files matching in a directory directory given below Here one of the folder has a space in the path. /MAS02/RMS/WBDev/Krishna/Krishna Mohan/FMSplitByKeyAfterChanges1000075383.fileman.*.txt.out.1000075383.0 The following works from command line ******************************** ls '/MAS02/RMS/WBDev/Krishna/Krishna Mohan/'FMSplitByKeyAfterChanges1000075383.fileman.*.txt.out.1000075383.0 I am trying to do the same stuff from shell script ,but it is not working. Pls suggest ******** #!/bin/ksh -x # in="/MAS02/RMS/WBDev/Krishna/Krishna Mohan/FMSplitByKeyAfterChanges1000075383.fileman.*.txt.out.1000075383.0" dirName=`dirname "$in"` fileName=`basename "$in"` newfileslist=\'$dirName/\'$fileName filecnt=`ls $newfileslist | wc -l ` It gives an error like this, when I execute above script **************************************** + ls /MAS02/RMS/WBDev/Krishna/Krishna Mohan/FMSplitByKeyAfterChanges1000075383.fileman.*.txt.out.1000075383.0 + wc -l ls: /MAS02/RMS/WBDev/Krishna/Krishna: No such file or directory ls: Mohan/FMSplitByKeyAfterChanges1000075383.fileman.*.txt.out.1000075383.0: No such file or directory + fcnt=0 Last edited by hikrishn; 06-18-2008 at 05:24 PM.. Reason: small correction to error message |
| Bookmarks |
| Tags |
| awk, awk trim, trim, trim awk |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|