- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Scripting Help
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
тАО08-31-2004 09:33 PM
тАО08-31-2004 09:33 PM
Scripting Help
I need to find all files with .afi extention.
After that i must cut the extention .afi und run a command with the files without extention.
- Tags:
- find
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-31-2004 09:43 PM
тАО08-31-2004 09:43 PM
Re: Scripting Help
!/bin/sh
set -x
for f in *.afi
do
afena $f ~/tmp
done
I must cut the .afi extention that afena command works !
Regards,
rene
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-31-2004 10:08 PM
тАО08-31-2004 10:08 PM
Re: Scripting Help
set -x
for f in `ls *.afi | sed 's/\.afi$//'`
do
afena $f ~/tmp
done
the sed will strip trailing ".afi" from each file. This will also work for files with multiple "." eg file.1.afi etc
- Tags:
- sed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-31-2004 10:50 PM
тАО08-31-2004 10:50 PM
Re: Scripting Help
for i in `ls *.afi|awk -F. '{print $1}'`
do
afena $i
done
This should work
Regards
Franky
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-31-2004 10:53 PM
тАО08-31-2004 10:53 PM
Re: Scripting Help
Just for your information, because previous posts works, it's sometimes useful to know about shell's capabilities. For example :
phelix> A=foo.abcd
phelix> echo $(basename $A .abcd)
foo
phelix> echo ${foo%%.abcd}
foo
Regards,
Jean-Louis
- Tags:
- basename
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-01-2004 12:02 AM
тАО09-01-2004 12:02 AM
Re: Scripting Help
On the console the commands works !
Command: for f in 'ls *.afi | sed 's/\.afi$//''
But in the Script it didn├В┬┤t work ?
Message:
+ afena ls t1.afi t2.afi | sed s/.afi$//
?????????????
Regards,
Re
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-01-2004 12:03 AM
тАО09-01-2004 12:03 AM
Re: Scripting Help
On the console the commands works !
Command: for f in 'ls *.afi | sed 's/\.afi$//''
But in the Script it didn├В┬┤t work ?
Message:
+ afena ls t1.afi t2.afi | sed s/.afi$//
?????????????
Regards,
Re
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-01-2004 12:14 AM
тАО09-01-2004 12:14 AM
Re: Scripting Help
why don't you just use the "awk" solution?
Even works in the script
Regards
Franky
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-01-2004 12:21 AM
тАО09-01-2004 12:21 AM
Re: Scripting Help
Thanks for your Help !
I only have one question !
Descripe to me the several characters above:
", ',`├В┬┤
Regards
Re
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-01-2004 12:22 AM
тАО09-01-2004 12:22 AM
Re: Scripting Help
It should read: -
for f in `ls *.afi | sed 's/\.afi$//'`
however you are now using: -
for f in 'ls *.afi | sed 's/\.afi$//''
Not the difference in quotes. The very first and last quotes should be backquote ` (top-left of your keyboard).
The awk solution suggested above will also work, however it will not take into account filenames with more than one "." in.