- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Unix Command needed or Procedure
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
Forums
Discussions
Discussions
Discussions
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
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
02-20-2003 04:15 AM
02-20-2003 04:15 AM
example :
file-name = "S.O."
the last character is ".", so to rename S.O. by S.O
=============================================
Thank you for your assistance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2003 04:21 AM
02-20-2003 04:21 AM
Re: Unix Command needed or Procedure
root /tmp >ll
total 108520
drwx------ 2 root root 1024 Feb 6 16:44 .AgentSockets
-rw-r--r-- 1 root root 23 Feb 6 16:44 96.sh
-rw-r----- 1 root sys 55511040 Feb 18 13:00 Ignite-UX-11-00.depot
prw-rw-rw- 1 root root 0 Feb 6 16:44 dhcpfifo.any
prw-rw-rw- 1 root root 0 Feb 6 16:44 dhcpfifo.root
-rw-rw-rw- 1 root root 16 Feb 6 16:45 last_uuid
-r--r--r-- 1 root root 0 Feb 6 16:44 llbdbase.dat
drwxrwxrwx 2 afeller users 1024 Nov 15 11:26 modemlog
root /tmp >find . -name '*t'
./dhcpfifo.root
./llbdbase.dat
./Ignite-UX-11-00.depot
root /tmp >
Regards ...
Armin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2003 04:22 AM
02-20-2003 04:22 AM
Re: Unix Command needed or Procedure
# echo "S.O."|sed -e 's/\.$//'
# echo $filename|sed -e 's/\.$//'
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2003 04:30 AM
02-20-2003 04:30 AM
Re: Unix Command needed or Procedure
if [[ -n ${filename##*[!.]} ]]; then
echo dot at the end
fi
Best regards...
Dietmar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2003 04:34 AM
02-20-2003 04:34 AM
Re: Unix Command needed or Procedure
cyb_hpux [ /consult/6/runs ] # export filename="S.O."
cyb_hpux [ /consult/6/runs ] # echo $filename
S.O.
cyb_hpux [ /consult/6/runs ] # echo $filename|sed -e 's^.$//'
sed: Function s^.$// cannot be parsed.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2003 04:34 AM
02-20-2003 04:34 AM
Re: Unix Command needed or Procedure
you can also list file names ending in dot with grep, e.g.:
# ls armand_blaise
file1 file1. file2 file3
# ls armand_blaise/ | grep "\.$"
file1.
but before renaming you should perhaps check if the filename without the dot already exists.
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2003 04:35 AM
02-20-2003 04:35 AM
Re: Unix Command needed or Procedure
# mv "$filename" "${filename%.}"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2003 04:36 AM
02-20-2003 04:36 AM
Re: Unix Command needed or Procedure
for file in `ls * | grep '\.$'`;do
echo mv $file ${file%.}
done
rgds, Robin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2003 04:40 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2003 05:36 AM
02-20-2003 05:36 AM
Re: Unix Command needed or Procedure
As I can see you have got a solution already but perhaps you should have a look at the "basename" command which can be used for removing suffixes.
Examole:
# >S.O.
# ls S.O*
S.O.
# basename S.O. .
S.O
# mv S.O. `basename S.O. .`
# ls S.O*
S.O