- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: problem with awk script..
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
тАО12-14-2006 04:24 AM
тАО12-14-2006 04:24 AM
Re: problem with awk script..
Based on the grep error message you provided, it doesn't appear you're using HP-UX (SunOS, perhaps?).
If that's the case, try:
$ /usr/xpg4/bin/grep -f file2 file1
or:
$ grep `cat file2` file1
PCS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-17-2006 06:22 PM
тАО12-17-2006 06:22 PM
Re: problem with awk script..
grep 'cat file1' file2 does not work..
thanks friends..
cheers..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-18-2006 02:13 AM
тАО12-18-2006 02:13 AM
Re: problem with awk script..
file1:
232323|2007|12|09
343434|2007|12|09
565656|2007|12|09
898989|2007|12|09
090909|2007|12|09
..
..
file 2:
232323
343434
343433
343432
343431
..
..
# join -1 1 -2 1 -t'|' -o 1.1 1.2 1.3 1.4 file1 file2
The join(1) example above "glues" the two files (file1 and file2) together on the fields that are common to both...which is field 1 as shown by command line options -> "-1 1 -2 1".
The field separator is the pipe character -t'|' (needs to be escaped or quoted as it has special meaning to the shell, and the output should consist of all fields from the first file -> "-o 1.1 1.2 1.3 1.4".
imho...not sure why the grep command by JRF is not working for you. It works perfectly on my HP-UX box. Are you using HP-UX or some other variant?
~hope it helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-18-2006 03:13 AM
тАО12-18-2006 03:13 AM
Re: problem with awk script..
of course JRF's solution works for Solaris as well - but you have to use the POSIX compliant binary:
/usr/xpg4/bin/grep -f file2 file1
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-18-2006 06:00 PM
тАО12-18-2006 06:00 PM
Re: problem with awk script..
yes /usr/xpg4/bin/grep -f file2 file1
works fine on my solaris..
thanks guys,
cheers,
- « Previous
-
- 1
- 2
- Next »