- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: tr question
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
08-08-2003 06:00 AM
08-08-2003 06:00 AM
I need to rename file from
/app/abd/12345.w55 to
/app/abd/12345.p55 in script.
echo ${file1} | tr 'w' 'p' is giving me
/ap/abd/12345.p55
It deletes one 'p'. It's in bash on SuSE SLES7.
I am talking about thousand files. Just change extension from w to p.
Thanks for your help in advance.
Andrej
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2003 06:02 AM
08-08-2003 06:02 AM
Re: tr question
tr -s 'w' 'p'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2003 06:56 AM
08-08-2003 06:56 AM
Re: tr question
Your question itself contains the solution.
tr -s actually squeeze and repeats. Leave the -s option to get your requirement. Check man tr.
-s, --squeeze-repeats
replace each input sequence of a repeated character that is
listed in SET1 with a single occurrence of that character
HTH,
Umapathy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2003 08:53 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2003 09:03 AM
08-08-2003 09:03 AM
Re: tr question
echo ${file1} | |sed 's/\.w/\.p/'
Regards,
Sergejs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2003 04:09 PM
08-10-2003 04:09 PM
Re: tr question
for FILE in /path/to/*.w??
do
mv $FILE ${FILE//\.w/\.p}
done
go bash ;) Much fun.