- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- for loop 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
тАО02-01-2008 08:37 AM
тАО02-01-2008 08:37 AM
I want to manipulate some data ie:
oldgemp016 to oldgemp030
I need to make these not mountable on system reboot (AIX) and the command line is
chfs -A n oldgemp
how would I sort the regular expression in a for loop??
I am kinda thinking I should
for a in `echo oldgemp0[1-3][0-9]`
however this will error on gemp010 11 12 etc becuase they dont exist.
how could this be resolved?
any help is greatly appreciated as always.
Thanks
Chris.
Solved! Go to Solution.
- Tags:
- for loop
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-01-2008 09:06 AM
тАО02-01-2008 09:06 AM
SolutionWill this one do?
$ i=15;while (($((i+=1))<=30));do echo oldgemp0$i;done
oldgemp016
oldgemp017
oldgemp018
oldgemp019
oldgemp020
oldgemp021
oldgemp022
oldgemp023
oldgemp024
oldgemp025
oldgemp026
oldgemp027
oldgemp028
oldgemp029
oldgemp030
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-01-2008 09:20 AM
тАО02-01-2008 09:20 AM
Re: for loop help
many thanks
chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-01-2008 09:33 AM
тАО02-01-2008 09:33 AM
Re: for loop help
I think there is a 'lsfs' on AIX, and I'm shure it was enough options to restrict its output to a parsable form.
Then something like
for in in `lsfs
do
...
done
or
for in in `lsfs
do
...
done
will present you only existing volumes.
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-01-2008 09:51 AM
тАО02-01-2008 09:51 AM
Re: for loop help
thanks Peter for the prompt
for FS in `lsfs -c |awk -F':' '/oldgemp/ {print $1}' |sed 's/\/app\///'`
do
etc etc
again another example however if I was looking for regular expression to find all values for oldgemp016 to oldgemp030
what would be the best systax?
thanks
Chris
- Tags:
- awk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-01-2008 10:11 AM
тАО02-01-2008 10:11 AM
Re: for loop help
> if I was looking for regular expression to find all values for oldgemp016 to oldgemp030
You could use:
# awk '/oldgemp0[1][6-9]|[2][0-9]|30/'
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-04-2008 02:54 AM
тАО02-04-2008 02:54 AM
Re: for loop help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-05-2008 11:01 PM
тАО02-05-2008 11:01 PM
Re: for loop help
I don't think the operator precedence is correct for your ERE. You need:
$ awk '/oldgemp0([1][6-9]|[2][0-9]|30)/'
Your first one finds "new20".
- Tags:
- regex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-06-2008 04:49 AM
тАО02-06-2008 04:49 AM
Re: for loop help
>Dennis: JRF I don't think the operator precedence is correct for your ERE
Good catch, thanks. You are correct, of course.
Regards!
...JRF...