- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- 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
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-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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2004 12:27 AM
09-01-2004 12:27 AM
Re: Scripting Help
#!/bin/sh
set -x
for f in $(ls -C1 *.afi | sed "s/\.afi$//")
do
echo $f
done
Regards,
Jean-Luc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2004 01:02 AM
09-01-2004 01:02 AM
Re: Scripting Help
Thanks for your help !
Rene
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2004 01:29 AM
09-01-2004 01:29 AM
Re: Scripting Help
-- test.ksh --
afena $1 ~/tmp
--------------
find
Is afena a shell script function ?
You can also do as,
for FILE in $(ls *.afi|perl -pe 's/.afi$//)
do
echo $FILE
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2004 11:33 PM
09-04-2004 11:33 PM
Re: Scripting Help
See if this works:
# find ./ -name *.afi | cut -d "." -f 1 | xargs
Regards,