- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Question for Ramesh ..
Operating System - HP-UX
1755730
Members
3957
Online
108837
Solutions
Forums
Categories
Company
Local Language
юдл
back
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
юдл
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
тАО09-14-2001 05:58 AM
тАО09-14-2001 05:58 AM
Alright Ramesh
last night . well should I say late last night you gave a response to a shell script question
cat $in_file | while read COL1 COL2
do
command -a $COL1 -b $COL2
done
Now my question is can you give me an example of what this output will look like or how I would use this in a script??
Richard
last night . well should I say late last night you gave a response to a shell script question
cat $in_file | while read COL1 COL2
do
command -a $COL1 -b $COL2
done
Now my question is can you give me an example of what this output will look like or how I would use this in a script??
Richard
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-14-2001 06:18 AM
тАО09-14-2001 06:18 AM
Solution
The output from that will depend greatly on what command is run. Who knows what the output will look like.
The person asking the question asked how to read in two strings each line in a file where each line had 2 values and then pass those values to a command. There were no details given as to what command he wanted to run.
You could do this for any command that you pass parameters to.
File to read:
-ld /dir
-la /dir2
cat $infile | while read COL1 COL2
do
ls $COL1 $COL2
done
That would then do an 'ls -ld /dir' and an 'ls -la /dir2'
Make sense?
The person asking the question asked how to read in two strings each line in a file where each line had 2 values and then pass those values to a command. There were no details given as to what command he wanted to run.
You could do this for any command that you pass parameters to.
File to read:
-ld /dir
-la /dir2
cat $infile | while read COL1 COL2
do
ls $COL1 $COL2
done
That would then do an 'ls -ld /dir' and an 'ls -la /dir2'
Make sense?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-14-2001 06:40 AM
тАО09-14-2001 06:40 AM
Re: Question for Ramesh ..
Hi Richard,
You can use this in various ways,
Simple eg:
Lets say you want to get the LVname and LV extents in a physical disk
pvdisplay -v /dev/dsk/c0t1d0 | awk '{print $1,$2}' |grep "/dev/" | while read LVNAME LVEXT
Now this gives the name of the LV and the LE of the LV on this disk,
another example
cat /etc/hosts | grep -v "^#" | while read IPADDR HOSTNAME ALIAS
do
echo "$IPADDR:$HOSTNAME:$ALIAS"
done
(This prints the your host table entries seperated by colon, and you can now do whatever you want with each of these variables in your script).
Another example,
ioscan -kfnC disk |grep dev |while read DISK RDISK
Does that answer your question?
-Ramesh
You can use this in various ways,
Simple eg:
Lets say you want to get the LVname and LV extents in a physical disk
pvdisplay -v /dev/dsk/c0t1d0 | awk '{print $1,$2}' |grep "/dev/" | while read LVNAME LVEXT
Now this gives the name of the LV and the LE of the LV on this disk,
another example
cat /etc/hosts | grep -v "^#" | while read IPADDR HOSTNAME ALIAS
do
echo "$IPADDR:$HOSTNAME:$ALIAS"
done
(This prints the your host table entries seperated by colon, and you can now do whatever you want with each of these variables in your script).
Another example,
ioscan -kfnC disk |grep dev |while read DISK RDISK
Does that answer your question?
-Ramesh
They think they know but don't. At least I know I don't know - Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-14-2001 07:54 AM
тАО09-14-2001 07:54 AM
Re: Question for Ramesh ..
Thats good stuff .. I like it !
What cleared it up was patricks example
and your /etc/hosts example.
Thanks,
Richard
What cleared it up was patricks example
and your /etc/hosts example.
Thanks,
Richard
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP