- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- find two words repeat in file
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
02-02-2009 12:32 PM
02-02-2009 12:32 PM
the words are repeated in different line numbers
using for, awk no work :
for var in "HostGroupName" "Parnert"
nawk '/"$var"/ {getline; getline; getline; getline; getline; getline; getline; getline; getline; getline; getline; getline x; getline y ; print x; print y}' Test
cat Test
Micro Program Revision : 165C/R
Array Unit Type : DF600
Serial Number : 68017811
MappingMode = ON
Reset/LIP Mode(Signal) = OFF
Reset/LIP Mode(Process) = OFF
LIP Port All Reset Mode = OFF
Read Frame Min 128 Byte Mode = OFF
HostGroupNumber = 0
HostGroupName = "jojo"
Platform = not specified
Alternate Path = not specified
Failover = not specified
Additional Parameters
......
......
MappingMode = ON
Reset/LIP Mode(Signal) = OFF
Reset/LIP Mode(Process) = OFF
LIP Port All Reset Mode = OFF
Read Frame Min 128 Byte Mode = OFF
HostGroupNumber = 0
HostGroupName = "jajaja"
Platform = not specified
Alternate Path = not specified
Failover = not specified
Additional Parameters
result that I need to obtain
HostGroupName = "jajaja"
Platform = not specified
HostGroupName = "jojo"
Platform = not specified
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2009 01:14 PM
02-02-2009 01:14 PM
Re: find two words repeat in file
# grep -e HostGroupName -e Platform Test
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2009 01:18 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2009 04:05 PM
02-02-2009 04:05 PM
Re: find two words repeat in file
grep -v -e ^$ |\
sort |\
uniq -c |\
grep -v -e "^ 1 " |\
while read CNT DATA
do
grep "${DATA}" Test
done
Additional Parameters
Additional Parameters
Alternate Path = not specified
Alternate Path = not specified
Failover = not specified
Failover = not specified
HostGroupName = "jojo"
HostGroupName = "jajaja"
HostGroupNumber = 0
HostGroupNumber = 0
LIP Port All Reset Mode = OFF
LIP Port All Reset Mode = OFF
MappingMode = ON
MappingMode = ON
Platform = not specified
Platform = not specified
Read Frame Min 128 Byte Mode = OFF
Read Frame Min 128 Byte Mode = OFF
Reset/LIP Mode(Process) = OFF
Reset/LIP Mode(Process) = OFF
Reset/LIP Mode(Signal) = OFF
Reset/LIP Mode(Signal) = OFF
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2009 08:15 PM
02-02-2009 08:15 PM
Re: find two words repeat in file
You can't put $var in single quotes:
for var in "HostGroupName" "Parnert"; do
awk "/$var/"' {getline; getline; getline; getline; getline; getline; getline; getline; getline; getline; getline; getline x; getline y; print x; print y}' Test
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2009 03:49 AM
02-03-2009 03:49 AM
Re: find two words repeat in file
this works ok , awk "/$var/"'