- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: grep command
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
тАО06-09-2004 11:25 PM
тАО06-09-2004 11:25 PM
Re: grep command
I made a mistake in the command, the correct one is:
grep $ADRESSIP file > /dev/null && echo $ADRESSIP.
Sorry
Frank.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-09-2004 11:33 PM
тАО06-09-2004 11:33 PM
Re: grep command
What about this one:
# cat > xyz
one
two three
four
five
#
# VAR=one
# cat xyz | grep "$VAR"
one
#
Remember i am using default POSIX shell of HPUX.
This should work with KSH also.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-09-2004 11:38 PM
тАО06-09-2004 11:38 PM
Re: grep command
YES, you need to PATCH your system, as "grep -w" and "grep -x" should exist and work.
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-09-2004 11:48 PM
тАО06-09-2004 11:48 PM
Re: grep command
Earlier one is having bug in that. Try this one. it is bit lengthy, hope you don't mind.
create one script called "myscr" and you have file called "xyz" then:
# cat myscript
#!/usr/bin/ksh
list=`cat xyz`
myfunct()
{
VAR11=$#
while true
do
if [ VAR11 -gt 0 ]
then
echo $1
shift
let VAR11=$VAR11-1
else
exit
fi
done
}
myfunct $list
----- end of script ----------
#chmod +x myscript
#./myscript | grep "$VAR"
I have tested this one and works fine.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-09-2004 11:57 PM
тАО06-09-2004 11:57 PM
SolutionAgain don't mind the lenght, it's once for all.
#!/usr/bin/ksh
echo " Enter values to be searched in file : "
read VAR1
echo "\n Enter file name in which the above value to be searched : "
read VAR2
list=`cat $VAR2`
myfunct()
{
VAR11=$#
while true
do
if [ VAR11 -gt 0 ]
then
echo $1
shift
let VAR11=$VAR11-1
else
exit
fi
done
}
myfunct $list | grep "$VAR1"
Let me know if that helped.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2004 12:09 AM
тАО06-10-2004 12:09 AM
Re: grep command
I get this problem when I use -w. Can u download a gnu version of grep and try grep -w ?.
Regds,
Kaps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2004 12:12 AM
тАО06-10-2004 12:12 AM
Re: grep command
We resolved this be downloading the gnu grep (ggrep) from www.gnu.org. ggrep has much more than -w to offer in my opinion.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2004 12:15 AM
тАО06-10-2004 12:15 AM
Re: grep command
perl -ne '/\b156.152.45.5\b/ && print' datafile
- Tags:
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2004 12:20 AM
тАО06-10-2004 12:20 AM
Re: grep command
export ADRESSIP="156.152.45.5"
perl -ne '/\b$ENV{ADRESSIP}\b/ && print'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2004 12:31 AM
тАО06-10-2004 12:31 AM
Re: grep command
Kaps