- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Commnad to find directory names having spaces
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-14-2006 09:49 AM
тАО12-14-2006 09:49 AM
Our one of the application creating 2 directories with the same name.
Looks like there are some space in the directory name.
What is command to find the directory having space after its name ?
Thanks,
Shiv
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-14-2006 10:19 AM
тАО12-14-2006 10:19 AM
Solutionls -b
Special characters will have \
ab\007cd
Another possibility is that there are trailing spaces in some of the names so you can use a small script to show each name in quotes to see if there leading or trailing spaces:
for MYFILE in *
do
echo "\"$MYFILE\""
done
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-14-2006 10:47 AM
тАО12-14-2006 10:47 AM
Re: Commnad to find directory names having spaces
You can also leverage 'find'. Try this:
# mkdir /tmp/badstuff
# cd /tmp/badstuff
# touch "filewith aspace"
# touch " leadingspaces"
# mkdir " dirwithleadingspaces"
Now:
# find /tmp/badstuff -name "*\ *"
/tmp/badstuff/filewith aspace
/tmp/badstuff/ leadingspaces
/tmp/badstuff/ dirwithleadingspaces
...the 'find' looks for *files* and *directories* because I didn't limit it with '-type f' or '-type d'.
The matching was for any string of characters that included the space character.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-14-2006 10:52 AM
тАО12-14-2006 10:52 AM
Re: Commnad to find directory names having spaces
If your CWD has dirs with spaces in them, then you could do something like:
# ls -p | awk -F"/" '{s=gsub(" ","<>");if(s) print $1}'
The above command will list all dirs that have spaces in them and it'll display the embedded spaces as a pair of angle brackets.
~hope it helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-14-2006 11:25 AM
тАО12-14-2006 11:25 AM
Re: Commnad to find directory names having spaces
I got the below output:-
\177venus
Is \177 space or tab in the begining ?
Regards,
Shiv
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-14-2006 11:34 AM
тАО12-14-2006 11:34 AM
Re: Commnad to find directory names having spaces
A \177 us a DEL character. You can determine any octal sequence by consulting the Ascii manpages:
# man 5 ascii
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-14-2006 11:48 AM
тАО12-14-2006 11:48 AM
Re: Commnad to find directory names having spaces
rmdir -i /?venus
The command will ask you if it is OK to remove the directory and if it looks correct, answer y to remove it. The reason for -i is in case there is a directory called /avenus or /Xvenus.
Bill Hassell, sysadmin