HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: grep and AWK
Operating System - HP-UX
1838655
Members
3518
Online
110128
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
Forums
Discussions
Discussions
Discussions
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
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
08-14-2002 08:02 AM
08-14-2002 08:02 AM
HI
I have the file attached in this message. I would like to read the file contents. I would like to extract the entire record of the disk-names ($1 ) having the pattern wmtpe, as of:
/fs35/wmtpe211
/fs35/wmtpe212
/fs35/wmtpe213
from the file attached, and place them into another file.
I would like to have the following types of record in file_A with pattern wmtpe:
/fs35/wmtpe212 wmt 16.8516 2.6224
/fs35/wmtpe213 wmt 13.6721 6.5676
/fs35/wmtpe214 wmt 16.8516 11.4333
and the other disk-names without the pattern wmtpe to be in file_B:
/fs36/nwdv.apv.bctl wmt 17.890 6.7809
/fs36/nwdv.shark.bctl wmt 18.978 5.4678
I tried the following:
for i in `cat fileName`
do
grep -v wmtpe >> temp_file
done
I'm not sure how I could extract the disk names with pattern wmtpe with its entire record, and place them into a file_A, and have the remaining disk-name entries, with its entire records into file_B.
Could someone please help me out?
Thanks.
I have the file attached in this message. I would like to read the file contents. I would like to extract the entire record of the disk-names ($1 ) having the pattern wmtpe, as of:
/fs35/wmtpe211
/fs35/wmtpe212
/fs35/wmtpe213
from the file attached, and place them into another file.
I would like to have the following types of record in file_A with pattern wmtpe:
/fs35/wmtpe212 wmt 16.8516 2.6224
/fs35/wmtpe213 wmt 13.6721 6.5676
/fs35/wmtpe214 wmt 16.8516 11.4333
and the other disk-names without the pattern wmtpe to be in file_B:
/fs36/nwdv.apv.bctl wmt 17.890 6.7809
/fs36/nwdv.shark.bctl wmt 18.978 5.4678
I tried the following:
for i in `cat fileName`
do
grep -v wmtpe >> temp_file
done
I'm not sure how I could extract the disk names with pattern wmtpe with its entire record, and place them into a file_A, and have the remaining disk-name entries, with its entire records into file_B.
Could someone please help me out?
Thanks.
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2002 08:14 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2002 08:19 AM
08-14-2002 08:19 AM
Re: grep and AWK
grep "wmtpe" this_file >> file_A
grep -v "wmtpe" this_file >> file_b
Did I misunderstand your message?.
-Sri
You may be disappointed if you fail, but you are doomed if you don't try
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2002 08:26 AM
08-14-2002 08:26 AM
Re: grep and AWK
You just have to be more specific with your grep statement. For example ..
$ grep \^/fs[1-9]*[0-9]/wmtpe fileName > file_A
..will match for all lines that begins with "/fs9>/wmtpe".
$ grep \^/fs[1-9]*[0-9]/nwdv fileName > file_B
..same explaination here except for "nwdv" in place of "wmtpe".
$ grep \^/fs[1-9]*[0-9]/wmtpe fileName > file_A
..will match for all lines that begins with "/fs
$ grep \^/fs[1-9]*[0-9]/nwdv fileName > file_B
..same explaination here except for "nwdv" in place of "wmtpe".
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.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP