- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- case 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-04-2008 09:44 AM
тАО02-04-2008 09:44 AM
on AIX i run the following command
root@tstestcl.eu.unilever.com # sysdumpdev -l
primary /dev/lg_dumplv
secondary /dev/lg_dumplv2
copy directory /var/adm/ras
forced copy flag TRUE
always allow dump TRUE
dump compression ON
this is the correct output on this system however it is not the case on all systems and I have over 1000 systems to check ....
I was going to use $1 to provide the string for the case statement
case $1 in
primary )
if [[ $2 = /dev/lg_dumplv ]] ; then
continue
else
echo "Run Funtions"
fi
;;
secondary )
if [[ $2 = /dev/lg_dumplv2 ]] ; then
continue
else
echo "Run Funtions"
fi
;;
copy )
if [[ $2 = /var/adm/ras ]] ; then
continue
else
echo "Run Funtions"
fi
;;
forced )
if [[ $2 = TRUE ]] ; then
continue
else
echo "Run Funtions"
fi
;;
always )
if [[ $2 = TRUE ]] ; then
continue
else
echo "Run Funtions"
fi
;;
dump )
if [[ $2 = ON ]] ; then
continue
else
echo "Run Funtions"
fi
from the command out put I can assign $1 to be the first filed and $2 to be the last field however I am having difficutly running this into awk ..
what would the most effeicient way to have $1 and $NF to be read by the case statement or is there a better solution for this?
thanks again for any help !
Chris.
Solved! Go to Solution.
- Tags:
- case
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-04-2008 10:05 AM
тАО02-04-2008 10:05 AM
SolutionIf I understand your objective, you want to parse the command output and pass this to your script using the first and the last fields of each parsed line as the script's $1 and $2 :
# ./myecommand | awk '{print $1,$NF}' | while read A B;do ./myscript ${A} ${B};done
Regards!
...JRF...
- Tags:
- awk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-04-2008 10:06 AM
тАО02-04-2008 10:06 AM
Re: case help
# awk '{if($1=="primary") if($NF!="/dev/lg_dumplv") print "Run Functions"}' file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-05-2008 12:25 AM
тАО02-05-2008 12:25 AM
Re: case help
$ grep -vf valid-output input-file
Of course if you get some output, you'll have to decode it to print an error. Or you can just print the whole output and say these are the bad lines:
grep -vf valid-output input-file > bad_file
if [ -s bad_file ]; then
echo "Run Functions"
# print or remove bad_file
fi
- Tags:
- grep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-05-2008 01:37 AM
тАО02-05-2008 01:37 AM
Re: case help
I'll let you know how I get on ...